Found 2628 Articles for Csharp

Difference between Method Overriding and Method Hiding in C#

Nitin Sharma
Updated on 09-Jun-2020 09:13:22

3K+ Views

In C# there are two mechanisms for redefining or providing the new implementation of a method of parent class by its child class and these two mechanisms are known as Method overriding and Method hiding. Now on the basis of how method re-implementation is done we can distinguish between both of them.Following are the important differences between Method Overriding and Method Hiding.Sr. No.KeyMethod OverridingMethod Hiding1DefinitionMethod Overriding is a mechanism to achieve polymorphism where the super class and sub class have same methods, including the parameters and signature and, when you call it using the sub class object, the implementation in ... Read More

Difference between SortedList and SortedDictionary in C#

Nitin Sharma
Updated on 09-Jun-2020 09:09:16

629 Views

Both SortedList and SortedDictionary in C# are the types of data structures used for data storage, now on the basis of characteristics and nature we can distinguish between both of them.Following are the important differences between SortedList and SortedDictionary.Sr. No.KeySortedListSortedDictionary1Memory organizationSortedList requires low memory for storage hence the memory status in its case is overhead.On other hand SortedDictionary requires more memory for storage so memory status in its case is not bottlenecked.2DesignedSortedList is internally implemented as in sortedList the elements are stored in a continuous block in memory.On other hand in SortedDictionary the elements are stored in separate object that ... Read More

Difference between Class and Structure in C#

Nitin Sharma
Updated on 09-Jun-2020 08:36:53

743 Views

In order to differentiate between Class and Structure, we have to first understand that both structure and class seems to be equivalent in the context of holding and defining the data. Both of these could define as well as hold some default values in their data members. But if we consider them beyond this context then Class provides more flexibility along with functionality as compared to the Structure.Following are the important differences between Class and Structure.Sr. No.KeyClassStructure1Data TypeData defined in a class is stored in the memory as a reference and has particular address in order to get accessed, so ... Read More

Difference between HashTable and Dictionary in C#

Nitin Sharma
Updated on 09-Jun-2020 07:51:55

5K+ Views

Both HashTable and Dictionary are the type of data structure which are used to store data. Both of these data structures hold the stored data in key value pair.On the basis of difference between key features of these we can distinguish between HashTable and Dictionary as follows −Sr. No.KeyHashTableDictionary1DefinitionHashTable is the non-generic type of collection which is used to store data in key/value pair and is defined in System.Collections name space.On other hand Dictionary is a generic type collection defined under System.Collection.Generics name space which also store data in the form of key/value pairs.2DataTypeIn HashTable same or different data type ... Read More

Difference between out and ref keyword in C#

Mahesh Parahar
Updated on 16-May-2020 14:16:00

16K+ Views

out keywordout keyword is used to pass arguments to method as a reference type and is primary used when a method has to return multiple values. ref keyword is also used to pass arguments to method as reference type and is used when existing variable is to be modified in a method. Following is the valid usage of ref and out keywords in C#.Example Live Demousing System.IO; using System; public class Program {    public static void update(out int a){       a = 10;    }    public static void change(ref int d){       d = 11; ... Read More

Difference between readonly and const keyword in C#

Mahesh Parahar
Updated on 16-May-2020 14:14:55

11K+ Views

readonly keywordreadonly keyword is used to define a variable which can be assigned once after declaration either during declaration or in constructor. const keyword is used to define a constant to be used in the program. Following is the valid usage of a readonly and const keywords in C#.Example Live Demousing System.IO; using System; public class Program {    public const int VALUE = 10;    public readonly int value1;    Program(int value){       value1 = value;    }    public static void Main() {       Console.WriteLine(VALUE);       Program p1 = new Program(11); ... Read More

Executing C# code in Linux

Ajay yadav
Updated on 05-Jan-2021 06:38:26

5K+ Views

The .NET centric applications are meant to windows operating system up till now, but now Microsoft has introduced a new cross-platform application called Mono which enables the execution of the application developed under the .NET platform in Linux environment by giving an impression in such a way that as if we are running Linux package rather than executing .exe file.MonoMono is an open-source utility that allows the developer to execute .NET centric applications on other platforms such as Mac or Linux as it provides an installation package for Windows platform to compile and execute .NET assemblies on Windows OS without ever ... Read More

Difference between system level exception and Application level exception.

Mahesh Parahar
Updated on 25-Feb-2020 06:26:47

2K+ Views

As we know that exception is something that refers to the interruption in the flow of program or application. This unwanted event is known as Exception and is generally gives the indication regarding something wrong within the code. Basically particularly in language C# an exception can be a System or an Application Level exception. So on the basisSr. No.KeySystem level exceptionApplication level exception1DerivationSystem exceptions are derived from the base class System.SystemException which in itself is a derived class of SystemException.On other hand Application-level exceptions are derived from the base class System.ApplicationException which is again a derived class of SystemException2OccurrenceIn general ... Read More

Difference between Abstract Class and Interface in C# Program

Mahesh Parahar
Updated on 24-Feb-2020 11:51:10

2K+ Views

As we all know that C# is an object oriented programming just like Java and provides full support for object-oriented concepts that are Encapsulation, Abstraction, Inheritance, and Polymorphism. In contrast to Abstraction both Abstract class and Interface are coming out in picture as both of these provides abstraction in C# program.In an abstract class, we can create the functionality and that needs to be implemented by the derived class. The interface allows us to define the functionality or functions but cannot implement that. The derived class extend the interface and implement those functions.Following are the important differences between Abstract Class ... Read More

Difference between var and dynamic in C#

Mahesh Parahar
Updated on 24-Feb-2020 11:25:58

5K+ Views

As we know that programming in any language get starts with declaration a variable after which its definition and logic implementation take place. So it is one of the most important factors to know that how to declare variable in any programming language before starts coding in it.Now if we take an instance of C# language there is change in declaration in variable with the advancement in the language. As in former version of C# all the code written was validated at the compile time itself which made it as Static typed language where variables are getting declared using var ... Read More

Advertisements