Akshay Khot has Published 37 Articles

How does the event pattern work in .NET?

Akshay Khot

Akshay Khot

Updated on 19-May-2021 08:05:42

433 Views

Events are a simplified pattern that uses delegates. In C#, all delegates have the multicast capability, i.e., an instance of a delegate can represent not just a single method but a list of methods. For example −Exampledelegate int Transformer(int x); static void Main(){    Transformer perform = x =>{   ... Read More

Explain the difference between const and readonly keywords in C#

Akshay Khot

Akshay Khot

Updated on 19-May-2021 07:50:10

608 Views

In C#, both the const and readonly keywords are used to define immutable values which cannot be modified once they are declared. However, there are some important differences between the two.constThe const modifier declares the constant values that are known at compile-time and do not change, i.e. they are immutable. ... Read More

What operators C# provides to deal with null values?

Akshay Khot

Akshay Khot

Updated on 19-May-2021 07:49:08

320 Views

C# has the following three operators to deal with the null values −null-coalescing operator (??)Allows you to get the value of a variable if it's not null, alternatively specifying a default value that can be used.It replaces the following expression in C# −string resultOne = value != null ? value ... Read More

How do interfaces work in C#?

Akshay Khot

Akshay Khot

Updated on 19-May-2021 07:47:44

439 Views

An interface defines a contract that will be implemented by a class or a struct. It can contain methods, properties, events, and indexers. An interface is similar to a class except that it doesn't hold any data and only specifies the behavior it can do (or more accurately, the class ... Read More

What is the usage of ref, out, and in keywords in C#?

Akshay Khot

Akshay Khot

Updated on 19-May-2021 07:41:00

406 Views

In C#, most of the methods can have zero or more parameters which define the data that must be provided to the method. Any code that calls the method has to pass the data (called arguments) to the method. A method declares its inputs as parameters, and they're provided by ... Read More

Provide a brief overview of the C# and .NET ecosystem

Akshay Khot

Akshay Khot

Updated on 19-May-2021 07:40:00

483 Views

C# is an object-oriented, type-safe and general-purpose programming language, which focuses on making the programmers productive. It tries to achieve this productivity through expressiveness, simplicity and a focus on performance. It works on different platforms such as Windows, Mac, and Linux.Type-SafetyC# is a statically typed language. That means the types ... Read More

Explain and contrast value types and reference types in C#

Akshay Khot

Akshay Khot

Updated on 19-May-2021 07:33:11

224 Views

In general, all types in C# can be divided into two main categories − value types and reference types. Let's look at each type in detail.Value TypesVariables of value types directly contain their data. Each variable has its own copy of the data. Hence it is impossible for a variable ... Read More

Advertisements