Karthikeya Boyini has Published 2383 Articles

Thread Pools in C#

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 17:31:47

4K+ Views

Thread pool in C# is a collection of threads. It is used to perform tasks in the background. When a thread completes a task, it is sent to the queue wherein all the waiting threads are present. This is done so that it can be reused.Let us see how to ... Read More

Substring in C#

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 17:24:37

465 Views

Substring is used to get the sub-parts of a string in C#. We have the substring() method for this purpose. Use the substring() method in C# to check each and every substring for unique characters. Loop it until the length of the string.If anyone the substring matches another, then it ... Read More

Try/catch/finally/throw keywords in C#

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 17:20:08

2K+ Views

Exception handling is based on the following keywords and its usage −try − A try block identifies a block of code for which particular exceptions is activated. It is followed by one or more catch blocks.catch − A program catches an exception with an exception handler at the place in ... Read More

What is the base class for all data types in C#.NET?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 17:12:27

1K+ Views

Object is the base class for all data types in C#. The Object Type is the ultimate base class for all data types in C# Common Type System (CTS). The object is an alias for System.Object class.When a value type is converted to object type, it is called boxing and ... Read More

How to use NameValueCollection class in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 17:10:28

477 Views

The NameValueCollection sets more than one value for a single key. Now let us see how to use them in our C# program.Set the collection −static NameValueCollection GetCollection() {    NameValueCollection myCollection = new NameValueCollection();    myCollection.Add("Tim", "One");    myCollection.Add("John", "Two");    myCollection.Add("Jamie", "Three");    return myCollection; }Now with the ... Read More

What are Tuples in C#4.0?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 16:04:01

703 Views

Tuples has a sequence of elements of different data types. It was introduced to return an instance of the Tuple with no need to specify the type of each element separately.Let us create a tuple with two elements. The following is how you declare a tuple. −Tupleperson = new Tuple ... Read More

Intersection of two arrays in C#

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 16:01:36

4K+ Views

To get intersection of two arrays, use the Intersect method. It is an extension method from the System.Linq namespace.The method returns the common elements between the two arrays.Set the two arrays first −int[] arr1 = { 44, 76, 98, 34 }; int[] arr2 = { 24, 98, 44, 55, 47, ... Read More

What is the difference between type conversion and type casting in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 15:59:33

330 Views

Type conversion and type casting are the same in C#. It is converting one type of data to another type. In C#, type casting has two forms −Implicit type conversion − These conversions are performed by C# in a type-safe manner. For example, are conversions from smaller to larger integral ... Read More

What is default constructor in C# programs?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 15:52:54

607 Views

A Constructor in C# is invoked automatically when an object gets created. The constructor has the same name as that of the class, for example, −public class Department {    public Department () {       Console.WriteLine("Default Constructor! ");    } }The following is the code that shows the ... Read More

How to pass parameters to a method in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 15:40:16

149 Views

To pass parameters to a method in C#, let us see how to pass parameters by value. In this mechanism, when a method is called, a new storage location is created for each value parameter.The values of the actual parameters are copied into them. Hence, the changes made to the ... Read More

Advertisements