Karthikeya Boyini has Published 2193 Articles

Overriding in C#

karthikeya Boyini

karthikeya Boyini

Updated on 21-Jun-2020 16:07:05

589 Views

Runtime polymorphism has method overriding that is also known as dynamic binding or late binding. It is implemented by abstract classes and virtual functions. Abstract classes contain abstract methods, which are implemented by the derived class.Let us see an example of abstract classes that implement runtime polymorphism and works with ... Read More

Priority Queues with C#

karthikeya Boyini

karthikeya Boyini

Updated on 21-Jun-2020 16:01:25

290 Views

A priority queue is held information with a priority value. It is an extension of queue.The item with the highest property is removed first when you try to eliminate an item from a priority queue.Let us see how to set priority queue −public class MyPriorityQueue where T : IComparable ... Read More

Serialization and Deserialization in C#

karthikeya Boyini

karthikeya Boyini

Updated on 21-Jun-2020 15:54:49

1K+ Views

Serialization converts objects into a byte stream and brings it to a form that it can be written on stream. This is done to save it to memory, file or database.Serialization can be performed as −Binary SerializationAll the members, even members that are read-only, are serializedXML SerializationIt serializes the public ... Read More

Final keyword in C#

karthikeya Boyini

karthikeya Boyini

Updated on 21-Jun-2020 15:48:12

5K+ Views

Java has a final keyword, but C# does not have its implementation. For the same implementation, use the sealed keyword.With sealed, you can prevent overriding of a method. When you use sealed modifiers in C# on a method, then the method loses its capabilities of overriding. The sealed method should ... Read More

How to use Remove, RemoveAt, RemoveRange methods in C# list collections?

karthikeya Boyini

karthikeya Boyini

Updated on 21-Jun-2020 15:45:41

1K+ Views

To implement Remove() and RemoveAt() methods in C#, try the following code −Firstly, set a list.List myList = new List() {    "mammals",    "reptiles",    "amphibians",    "vertebrate" };Now, use Remove() method to remove an element.myList.Remove("reptiles");Now, use RemoveAt() method to remove an element by setting the position.myList.RemoveAt(2);The following is ... Read More

What are the differences between a dictionary and an array in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 21-Jun-2020 15:36:19

692 Views

DictionaryDictionary is a collection of keys and values in C#. Dictionary is included in the System.Collection.Generics namespace.To declare a Dictionary −IDictionary d = new Dictionary();To add elements −IDictionary d = new Dictionary(); d.Add(1, 97); d.Add(2, 89); d.Add(3, 77); d.Add(4, 88);ArrayArray stores a fixed-size sequential collection of elements of the same ... Read More

Decimal to Multiple-Bases Conversion with Stack

karthikeya Boyini

karthikeya Boyini

Updated on 21-Jun-2020 15:33:36

630 Views

For multiple-base conversions, set a variable and add the base you want to calculate.Here, for our example, I have set the variable baseNum as 2 −int baseNum = 2;In the same way, if you want base 8, then set the above as −int baseNum = 2; You can also get ... Read More

Why do we use internal keyword in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 21-Jun-2020 15:28:22

3K+ Views

Internal keyword allows you to set internal access specifier.Internal access specifier allows a class to expose its member variables and member functions to other functions and objects in the current assembly.Any member with internal access specifier can be accessed from any class or method defined within the application in which ... Read More

How to copy a List collection to an array?

karthikeya Boyini

karthikeya Boyini

Updated on 21-Jun-2020 15:16:52

797 Views

To copy a C# list collection to an array, firstly set a list −List list1 = new List (); list1.Add("One"); list1.Add("Two"); list1.Add("Three"); list1.Add("Four");Now declare a string array and use the CopyTo() method to copy −string[] arr = new string[20]; list1.CopyTo(arr);Let us see the complete code to copy a ... Read More

What is C# Programming?

karthikeya Boyini

karthikeya Boyini

Updated on 21-Jun-2020 15:04:37

301 Views

C# is a modern, general-purpose, object-oriented programming language developed by Microsoft.C# is designed for Common Language Infrastructure (CLI), which consists of the executable code and runtime environment that allows the use of various high-level languages on different computer platforms and architectures.Here are the features of C# −Boolean ConditionsAutomatic Garbage CollectionStandard ... Read More

Advertisements