Tutorialspoint

Private Methods in C#

Chandu yadav
Answered 2d 1h ago

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 ... Read More

Overriding in C#

karthikeya Boyini
Answered 2d 1h ago

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 ... Read More

Numbers in C#

Maheshwari Thakur
Answered 2d 1h ago

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() { ... Read More

Null Pointer Exception in C#

Samual Sam
Answered 2d 1h ago

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 { ... Read More

Naming Conventions in C#

Ankith Reddy
Answered 2d 1h ago

Naming convetion for classes A 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 Casing The coding conventions for a class name is the the name of ... Read More

Mutation Test tools in C#

karthikeya Boyini
Answered 2d 1h ago

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 ... Read More

Nested Classes in C#

George John
Answered 2d 1h ago

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# − class One ... Read More

Overloading in C#

Samual Sam
Answered 2d 1h ago

Overloading is of two types in C#. Function Overloading You 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 ... Read More

Optional property in a C# class

Chandu yadav
Answered 2d 1h ago

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 − [AttributeUsage(AttributeTargets.Property, Inherited = false, ... Read More

Private Variables in C#

karthikeya Boyini
Answered 2d 1h ago

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. Create a private variable − private double ... Read More

Optimization Tips for C# Code

Maheshwari Thakur
Answered 2d 1h ago

The following are the tips − Prefer List Use List whenever necessary. Working with ArrayList for the same work can make the working of code slower. This is specially if you are storing multiple types of objects within the same list. Use multiplication-shift operation Prefer multiplication-shift operation instead of ... Read More

Operators, Types and Variables in C#

Samual Sam
Answered 2d 2h ago

Variables in C# A variable is a name given to a storage area that our programs can manipulate. Each variable in C# has a specific type, which determines the size and layout of the variable's memory the range of values that can be stored within that memory and the set ... Read More

Operator Functions in C#

Ankith Reddy
Answered 2d 3h ago

Operator functions are overloaded operator, which are the functions with special names. To create it, the keyword operator is followed by the symbol for the operator being defined. Like any other function, an overloaded operator has a return type and a parameter list. For example − public static ... Read More

Private Constructors and Singleton Classes in C#

Samual Sam
Answered 2d 3h ago

A private constructor is used in classes containing only static member as shown below − class Demo { // private constructor private Demo() { } public static a = 10; } A singleton class has normal methods and ... Read More

Private and final methods in C#

George John
Answered 2d 3h ago

Private Methods 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 ... Read More

Previous 1 ... 4 5 6 7 8 9 10 ... 724 Next
Advertisements
Loading...
Unanswered Questions View All