1. Math Methods These are the methods that are used for performing mathematical operations in C#. Some common Math methods are Abs(), Ceiling(), Floor(), Round(), etc. These methods are available in the System.Math package.
Example:
double number = 4.5;
double absoluteValue = Math.Abs(number);
2. String Methods String methods are used for manipulating strings in C#. Some common String methods are ToUpper(), ToLower(), Substring(), Trim(), Replace(), etc. These methods are available in the System package.
Example:
string sentence = "This is a sentence.";
string upperCaseSentence = sentence.ToUpper();
3. List Methods List methods are used for manipulating lists in C#. Some common List methods are Add(), Remove(), Count(), Contains(), etc. These methods are available in the System.Collections.Generic package.
Example:
List colors = new List() { "Red", "Blue", "Green" };
colors.Add("Yellow");
4. File Methods File methods are used for working with files in C#. Some common File methods are ReadAllText(), WriteAllText(), Delete(), Exists(), etc. These methods are available in the System.IO package.
5. Date/Time Methods Date/Time methods are used for working with dates and times in C#. Some common Date/Time methods are Now(), AddDays(), ToShortDateString(), ToLongTimeString(), etc. These methods are available in the System package.
Example:
DateTime currentDate = DateTime.Now;
DateTime tomorrow = currentDate.AddDays(1);
C# (CSharp) methods - 35 examples found. These are the top rated real world C# (CSharp) examples of methods extracted from open source projects. You can rate examples to help us improve the quality of examples.