Tutorialspoint

Difference between TrimStart() and TrimEnd() in C#

Maheshwari Thakur
Answered 2h 30m ago

TrimStart() method removes all leading occurrences of a set of characters, whereas TrimEnd()removes all trailing occurrences of a set of characters. TrimStart() The TrimStart() method removes all leading occurrences of a set of characters specified in an array. Let us see an example to remove all leading zeros − Example ... Read More

What is the difference between pass by value and reference parameters in C#?

karthikeya Boyini
Answered 2h 32m ago

Reference Parameters A reference parameter is a reference to a memory location of a variable. The reference parameters represent the same memory location as the actual parameters that are supplied to the method. When you pass parameters by reference, unlike value parameters, a new storage location is not created for ... Read More

What is the difference between overriding and hiding in C#?

Ankith Reddy
Answered 2h 33m ago

Method hiding is also called shadowing in C#. The method of the parent class is available to the child class without using the override keyword in shadowing. The child class has its own version of the same function. Define a behavior that is specific to the subclass type in overriding, ... Read More

What is the difference between Read() and ReadLine() methods in C#?

George John
Answered 2h 36m ago

Read() The Read() reads the next characters from the standard input stream. If a key is pressed on the console, then it would close. int a = Console.Read() Console.WriteLine(a); ReadLine() It reads the next line of characters from the standard input stream. Example Live Demo using ... Read More

What is the difference between initialization and assignment of values in C#?

Chandu yadav
Answered 3h 5m ago

Let us understand the difference between initialization and assignment of values. Declaring an array. int [] n // declaring Initialization Declaring an array does not initialize the array in the memory. When the array variable is initialized, you can assign values to the array. Array is ... Read More

What is the difference between keywords const and readonly in C#?

karthikeya Boyini
Answered 3h 8m ago

Const Constant fields are the fields that cannot be modified. At the time of declaration, you need to assign a value to it. const int a = 5; Readonly A Read-only field is initialized at the time of declaration or you can also set it within the constructor. ... Read More

What is the difference between objects and classes in C#?

Samual Sam
Answered 3h 16m ago

C# has object and classes like Java. Objects are real-world entities and instance of a class. Access the members of the class using an object. To access the class members, you need to use the dot (.) operator after the object name. The dot operator links the name of an ... Read More

Infinity or Exception in C# when divide by 0?

Maheshwari Thakur
Answered 3h 17m ago

Divide by zero is the System.DivideByZeroException, which is a class that handles errors generated from dividing a dividend with zero. Let us see an example. Example Live Demo using System; namespace ErrorHandlingApplication { class DivNumbers { int result; ... Read More

What is the overload ability of operators in C#

karthikeya Boyini
Answered 3h 27m ago

Here is the list of the operator that can be overloaded in C# and which do not have the capability to overload. Sr.No Operator & Description 1 +, -, !, ~, ++, -- These unary operators take one operand and can be overloaded. 2 ... Read More

Methods of the Thread Class

Ankith Reddy
Answered 3h 28m ago

Some of the popular methods of a Thread class is start, sleep, jon, and abort. Let us see the complete list of methods − Sr.No. Method & Description 1 public void Abort() Raises a ThreadAbortException in the thread on which it is invoked, to begin the ... Read More

What is the difference between Read(), ReadKey() and ReadLine() methods in C#?

George John
Answered 4h 10m ago

Read() The Read() reads the next characters from the standard input stream. If a key is pressed on the console, then it would close. int az = Console.Read() Console.WriteLine(z); ReadKey() It reads only a single charactare from the standard input stream. ReadLine() Reads the next line of characters ... Read More

Increment and Decrement Operators in C#

Samual Sam
Answered 4h 14m ago

Increment operator increases integer value by one i.e. int a = 10; a++; ++a; Decrement operator decreases integer value by one i.e. int a = 20; a--; --a; The following is an example demonstrating increment operator − Example Live Demo using System; class ... Read More

Inbuilt Data Structures in C#

Chandu yadav
Answered 4h 14m ago

C# has a lot of inbuilt Data Structures. Here are two of them − List Generic List<T> is a generic collection and the ArrayList is a non-generic collection. The size can be dynamicallyincreased using List, unlike Arrays. Let us see an example. We have set the List first − ... Read More

Important Keywords in C#

karthikeya Boyini
Answered 4h 50m ago

Some of the key keywords in C#, include. Sealed Params Internal this abstract Sealed When 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 ... Read More

Difference between prefix and postfix operators in C#?

Maheshwari Thakur
Answered 4h 50m ago

Prefix Operator The 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 ... Read More

Advertisements
Loading...
Unanswered Questions View All