
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 33676 Articles for Programming

17K+ Views
Typeof()The type takes the Type and returns the Type of the argument.For example: System.Byte for the following −typeof(byte)The following is an example −Example Live Demousing System; class Program { static void Main() { Console.WriteLine(typeof(int)); Console.WriteLine(typeof(byte)); } }OutputSystem.Int32 System.ByteGetType()The GetType() method of array class in C# gets the Type of the current instance.To get the type.Type tp = value.GetType();In the below example, we are checking the int value using the type.if (tp.Equals(typeof(int))) Console.WriteLine("{0} is an integer data type.", value)The following is the usage of GetType() method in C#.Example Live Demousing System; class Program { ... Read More

14K+ Views
Let’s say the following is our string with leading zeros.String str ="000234";Use the TrimStart() method and set the 0 to remove it.TrimStart(new Char[] { '0' } )The following is the complete code to remove leading zeros.Example Live Demousing System; class Program { static void Main() { String str ="000234".TrimStart(new Char[] { '0' } ); Console.WriteLine(str); } }Output234

22K+ Views
To generate random numbers in C#, use the Next(minValue, MaxValue) method. The parameters are used to set the minimum and maximum values.Next(100,200);We have set the above method under Random() object.Random rd = new Random(); int rand_num = rd.Next(100,200);The following is an example −Example Live Demousing System; class Program { static void Main() { Random rd = new Random(); int rand_num = rd.Next(100,200); Console.WriteLine(rand_num); } }Output182

6K+ Views
The difference between Write() and WriteLine() method is based on new line character.Write() method displays the output but do not provide a new line character.WriteLine() method displays the output and also provides a new line character it the end of the string, This would set a new line for the next output.Let us see an example to learn about the difference between Write() and WriteLine() method −Example Live Demousing System; class Program { static void Main() { Console.Write("One"); Console.Write("Two"); // this will set a new line for the next output ... Read More

879 Views
The System.Console class in C# represents the standard input, output, and error streams for console applications.The following are some of the methods of the System.Console class −Refer: MSDN System Class methodsSr.NoMethod & Description1Beep()Plays the sound of a beep through the console speaker.2Beep(Int32, Int32)Plays the sound of a beep of a specified frequency and duration through the console speaker.3Clear()Clears the console buffer and corresponding console window of display information.4MoveBufferArea(Int32, Int32, Int32, Int32, Int32, Int32)Copies a specified source area of the screen buffer to a specified destination area.5MoveBufferArea(Int32, Int32, Int32, Int32, Int32, Int32, Char, ConsoleColor, ConsoleColor)Copies a specified source area of the ... Read More

2K+ Views
The break statement terminates the loop and transfers execution to the statement immediately following the loop.The continue statement causes the loop to skip the remainder of its body and immediately retest its condition prior to reiterating.When the break statement is encountered inside a loop, the loop is immediately terminated and program control resumes at the next statement following the loop.The continue statement in C# works somewhat like the break statement. Instead of forcing termination, however, continue forces the next iteration of the loop to take place, skipping any code in between.The following is the complete code to use continue statement in a ... Read More

581 Views
Interfaces define properties, methods, and events, which are the members of the interface. Interfaces contain only the declaration of the members. It is the responsibility of the deriving class to define the members.Abstract classes to some extent serve the same purpose, however, they are mostly used when only a few methods are to be declared by the base class and the deriving class implements the functionalities.The following are the differences −A class may inherit more than one interface, whereas a class may inherit only one abstract class.Multiple Inheritance cannot be achieved using Abstract whereas with Interface we can achieve it.You ... Read More

6K+ Views
A thread is defined as the execution path of a program. Each thread defines a unique flow of control.The following are the properties of the Thread class −Sr.No.Property & Description1CurrentContextGets the current context in which the thread is executing.2CurrentCultureGets or sets the culture for the current thread.3CurrentPrincipleGets or sets the thread's current principal (for role-based security).4currentThreadGets the currently running thread.5CurrentUICultureGets or sets the current culture used by the Resource Manager to look up culture-specific resources at run-time.6ExecutionContextGets an ExecutionContext object that contains information about the various contexts of the current thread.7IsAliveGets a value indicating the execution status of the current ... Read More