- 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
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
448 Views
To reverse a string, use the Array.Reverse() method.Set the string you want to reverse −string str = "Amit";In the above method, we have converted the string into character array −char[] ch = str.ToCharArray();Then the Reverse() method is used.Array.Reverse(ch);Exampleusing System; namespace Demo { class Program { static void Main(string[] args) { string str = "Amit"; char[] ch = str.ToCharArray(); Array.Reverse(ch); foreach(var items in ch) { Console.WriteLine(items); } Console.ReadLine(); } } }
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
6K+ Views
Private Methods can only be used inside the class. To set private methods, use the private access specifier.Private access specifier allows a class to hide its member variables and member functions from other functions and objects. Only functions of the same class can access its private members. Even an instance of a class cannot access its private members.The following is an example −Exampleusing System; class Demo { private int displayOne() { return 10; } public int displayTwo() { return 10; } } class Program { static ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
411 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 Overriding −Exampleusing System; namespace PolymorphismApplication { abstract class Shape { public abstract int area(); } class Rectangle: Shape { private int length; private int width; public Rectangle( int a = 0, int ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
129 Views
For numbers in C#, use the int type. It represents an integer, which is positive or negative whole number.Let us see how to add two integers in C# using mathematical operator + −using System; using System.Linq; class Program { static void Main() { int x = 20; int y = 30; int sum = 0; sum = x + y; Console.WriteLine(sum); } }Now let us learn about the order in which these mathematical operators i.e. operator precedence.Operator precedence determines the grouping ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
3K+ Views
NullReferenceException is a C# version of NullPointerException. To handle and catch it in C#, use try-catch.The below example shows that a variable is set to null and when we try to print it, it throws an exception that gets caught in the catch −Try { a = null; Console.WriteLine(a); }catch (NullPointerException ex) { Console.WriteLine("Variable is Null!"); }The above will allow the exception to be caught and use catch for it.
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
2K+ Views
Naming convetion for classesA class definition starts with the keyword class followed by the class name; and the class body enclosed by a pair of curly braces. The following are the conventions for class names.Pascal CasingThe coding conventions for a class name is the the name of the class names, for example, it should being PascalCasing.public class EmployeeDetails {}Above, the class name EmployeeDetails is in PascalCasing.Noun or Noun PhrasesPrefer adding class names as noun or noun phrases −public class Employee {} Identifier is a name used to identify a class, variable, function, or any other user-defined item.The following are the ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
250 Views
One of the best tools for mutation testing in C# is “VisualMutator” It is integrated with the .NET programming environment.The following are the features of VisualMutant, which is a mutation test tool −Measure the quality of the test suite.To create first-order mutants using built-in and custom mutation operators.View modified code fragments in C#.Run NUnit and XUnit tests on generated mutants.Provides information about passed and failed testsYou can also write the results to XML.View details about any mutant right after the start of the mutation testing processIt gives results as mutation score
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
448 Views
Nested class is a class declared in another enclosing class. It is a member of its enclosing class and the members of an enclosing class have no access to members of a nested class.Let us see an example code snippet of nested classes in C# −Exampleclass One { public int val1; public class Two { public int val1; } } class Demo { static void Main() { One a = new One(); a.val1++; One.Two ab = new One.Two(); ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
213 Views
Overloading is of two types in C#.Function OverloadingYou can have multiple definitions for the same function name in the same scope. The definition of the function must differ from each other by the types and/or the number of arguments in the argument list.Let us see an example −public static int mulDisplay(int one, int two) { } public static int mulDisplay(int one, int two, int three) { } public static int mulDisplay(int one, int two, int three, int four) { }Operator OverloadingOverloaded operators are functions with special names. The keyword operator is followed by the symbol for the operator being defined.public ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
4K+ Views
A property is optional if it is possible and valid for it to have null. A property whose CLR type cannot have null cannot be configured optional.An example optional attribute usage −Example[AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)] internal sealed class OptionalAttribute : Attribute { } public class Employee { public string EmpName { get; set; } [Optional] public string AlternativeName { get; set; } }