- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 2628 Articles for Csharp
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
370 Views
The RemoveAt method in C# is used to remove an element in a list at a position you set.Firstly, set elements in the list −var subjects = new List(); subjects.Add("Physics"); subjects.Add("Chemistry"); subjects.Add("Biology"); subjects.Add("Science");To remove an element, set the index from where you want to eliminate the element. The following is to remove element from the 3rd position −subjects.RemoveAt(2);Let us see the complete code −Example Live Demousing System; using System.Collections.Generic; public class Demo { public static void Main(string[] args){ var subjects = new List(); subjects.Add("Physics"); subjects.Add("Chemistry"); subjects.Add("Biology"); ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
540 Views
The @prefix states hat you don't need to escape special characters in the string following to the symbol.The following statement@"D:ew"is equal to:"D:ew"The @ prefix is also used if you want to have large strings and want it to be displayed across multiple lines. The following is an example showing multi-line string −Example Live Demousing System; namespace Demo { class Program { static void Main(string[] args) { string str = @"Welcome User, Kindly wait for the image to load"; Console.WriteLine(str); } } }OutputWelcome User, Kindly wait for the image to load
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
198 Views
Let us see an example to find the number of dimensions of an array, using the Rank property.arr.RankHere, arr is our array −int[, ] arr = new int[5, 5];If you want to get the rows and columns the array has, then use the GetLength property −arr.GetLength(0); arr.GetLength(1);The following is the complete code −Example Live Demousing System; class Program { static void Main() { int[, ] arr = new int[4, 5]; Console.WriteLine(arr.GetLength(0)); Console.WriteLine(arr.GetLength(1)); Console.WriteLine("Upper Bound: {0}", arr.GetUpperBound(0).ToString()); Console.WriteLine("Lower Bound: {0}", arr.GetLowerBound(0).ToString()); ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
794 Views
A member function i.e. method of a class is a function that has its definition or its prototype within the class definition similar to any other variable. It operates on any object of the class of which it is a member, and has access to all the members of a class for that object.The following is an example −public void setLength( double len ) { length = len; } public void setBreadth( double bre ) { breadth = bre; }The following is an example showing how to access class member functions in C# −Example Live Demousing System; ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
430 Views
Ref ParameterA reference parameter is a reference to a memory location of a variable. When you pass parameters by reference, unlike value parameters, a new storage location is not created for these parameters.You can declare the reference parameters using the ref keyword. The following is an example −Example Live Demousing System; namespace CalculatorApplication { class NumberManipulator { public void swap(ref int x, ref int y) { int temp; temp = x; /* save the value of x */ x = y; /* put ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
395 Views
ConstructorsA class constructor is a special member function of a class that is executed whenever we create new objects of that class.A constructor has exactly the same name as that of class and it does not have any return type.Constructor has the same name as the class name −class Demo { public Demo() {} }The following is an example −Example Live Demousing System; namespace LineApplication { class Line { private double length; // Length of a line public Line() { Console.WriteLine("Object is being created"); ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
5K+ Views
Dynamic arrays are growable arrays and have an advantage over static arrays. This is because the size of an array is fixed.To create arrays dynamically in C#, use the ArrayList collection. It represents an ordered collection of an object that can be indexed individually. It also allows dynamic memory allocation, adding, searching and sorting items in the list.The following is an example showing how to create arrays dynamically in C# −Example Live Demousing System; using System.Collections; namespace Demo { class Program { static void Main(string[] args) { ArrayList al = new ArrayList(); ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
531 Views
In C#, some identifiers have special meaning in context of code, such as get and set are called contextual keywords.The following is the table showing contextual keywords −Contextual Keywordsaddaliasascendingdescendingdynamicfromgetglobalgroupintojoinletorderbypartial (type)partial(method)removeselectset
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
428 Views
A class constructor is a special member function of a class that is executed whenever we create new objects of that class.A constructor has exactly the same name as that of class and it does not have any return type.Constructor has the same name as the class name −class Demo { public Demo() {} }The following is an example −Example Live Demousing System; namespace LineApplication { class Line { private double length; // Length of a line public Line() { Console.WriteLine("Object is being created"); ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
134 Views
Comments are used for explaining code. Compilers ignore the comment entries. The multiline comments in C# programs start with /* and terminates with the characters */ as shown below.Multi-line comments/* The following is a mult-line comment In C# /*The /*...*/ is ignored by the compiler and it is put to add comments in the program.Single line comments// variable int a = 10;The following is a sample C# program showing how to add single-line as well as multi-line comments −Example Live Demousing System; namespace Demo { class Program { static void Main(string[] args) { ... Read More