
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 2587 Articles for Csharp

362 Views
Some of the key keywords in C#, include.SealedParamsInternalthisabstractSealedWhen you use sealed modifiers in C# on a method, then the method loses its capabilities of overriding. The sealed method should be part of a derived class and the method must be an overridden method.ParamsWhile declaring a method, you are not sure of the number of arguments passed as a parameter, then use params. C# param arrays can let you know about this.InternalInternal 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 ... Read More

7K+ Views
Prefix OperatorThe increment operator ++ if used as prefix on a variable, the value of variable gets incremented by 1. After that the value is returned unlike Postfix operator. It is called Prefix increment operator. In the same way the prefix decrement operator works but it decrements by 1.For example, an example of prefix operator −++a;The following is an example demonstrating Prefix increment operator −Example Live Demousing System; class Program { static void Main() { int a, b; a = 50; Console.WriteLine(++a); b = a; ... Read More

2K+ Views
You can store any type of value in the dynamic data type variable. Type checking for these types of variables takes place at run-time.The Object Type is the ultimate base class for all data types in C# Common Type System (CTS). The object is an alias for System. Object class. The object types can be assigned values of any other types, value types, reference types, predefined or user-defined types.Dynamic types are similar to object types except that type checking for object type variables takes place at compile time, whereas that for the dynamic type variables takes place at runtime.Example of ... Read More

1K+ Views
TrimA string method that removes all the leading and trailing whitespaces in a string.For example, the string “jack sparrow“ would be returned as the following without leading and whitespaces using trim().jack sparrowThe following is an example −Example Live Demousing System; namespace Demo { class Program { static void Main(string[] args) { string str = " Amit "; Console.WriteLine(str); // trim Console.WriteLine("After removing leading and trailing whitespace..."); string res = str.Trim(); Console.WriteLine(res); ... Read More

12K+ Views
Declaration means that variable is only declared and memory is allocated, but no value is set.However, definition means the variables has been initialized.The same works for variables, arrays, collections, etc.VariablesDeclaring a variable.int x;Let’s define and assign a value.x = 10; ArraysDeclaring an array.int [] n // declaring int n= new int[10]; // initializingLet’s assign a value.n[0] = 100; n[1] = 200

1K+ Views
The Object class is the base class of all the classes in C#. It has the following methods on C#.Sr.NoMethod & Description1Equals(Object)Determines whether the specified object is equal to the current object.2Equals(Object, Object, Determines whether the specified object instances are considered equal.3Finalize()Allows an object to try to free resources4GetHashCode()default hash function.5GetType()Type of the current instance.6MemberwiseClone()shallow copy of the current Object.7ReferenceEquals(Object, Object)Determines whether the specified Object instances are the same instance.8ToString()Returns a string that represents the current object.Let us see an example how to create an object of a class in C#.Example Live Demousing System; namespace MyApplication { class Demo { ... Read More

16K+ Views
The easiest way to convert an integer to a string in C# is using the ToString() method.Let us see an example −int a = 100; string str = a.ToString();Another way is to use Convert.ToString();b = 50; string str2 = Convert.ToString(b); Console.WriteLine(str2);The following is the example showing the different ways to convert integer to string.Example Live Demousing System; class Program { static void Main() { int a, b, c; a = 10; string str = a.ToString(); Console.WriteLine(str); b = 50; string str2 = Convert.ToString(b); Console.WriteLine(str2); c = 100; string str3 = string.Format("{0}", c); Console.WriteLine(str3); } }Output10 50 100

8K+ Views
Use the new keyword to create an instance of the array. The new operator is used to create an object or instantiate an object. Here in the example an object is created for the class using the new.The following is an example.Calculate c = new Calculate();You can also use the new keyword to create an instance of the array.double[] points = new double[10];The new keyword is also used to create object of a collection.SortedList sl = new SortedList(); // SortedList List myList = new List() // ListLet us see an example.Example Live Demousing System; class Program { static void Main() ... Read More

17K+ Views
Typeof()The type takes the Type and returns the Type of the argument.For example: System.Byte for the following −typeof(byte)The following is an example −Example Live Demousing System; class Program { static void Main() { Console.WriteLine(typeof(int)); Console.WriteLine(typeof(byte)); } }OutputSystem.Int32 System.ByteGetType()The GetType() method of array class in C# gets the Type of the current instance.To get the type.Type tp = value.GetType();In the below example, we are checking the int value using the type.if (tp.Equals(typeof(int))) Console.WriteLine("{0} is an integer data type.", value)The following is the usage of GetType() method in C#.Example Live Demousing System; class Program { ... Read More