Join Our Email Alerts-Subscribe
Important Note:Login & Check Your Email Inbox and Activate Confirmation Link

Enter Your Email :

Copyright Disclaimer:
Section 107 of the Copyright Act Fair Use Contents .
We are forwarding content link(s) from our website to content website & We are not serving any contents.
Main the Content PDF link(s) is/are obtained from GoogleSearch
for the purpose of Education & Teaching Intention. Not for commercial purpose. is not liable/responsible for any copyright issues.

C# Materials Free Download

. What is the difference between ref and out keywords? 


In C Sharp (C#) we can have three types of parameters in a function. The parameters can be in parameter (which is not returned back to the caller of the function), out parameter and ref parameter. We have lots of differences in both of them. 

11. Can “this” be used within a static method? 


We can't use this in static method because keyword 'this' returns a reference to the current instance of the class containing it. Static methods (or any static member) do not belong to a particular instance. They exist without creating an instance of the class and call with the name of a class not by instance so we can’t use this keyword in the body of static Methods, but in case of Extension Methods we can use it the functions parameters. Let’s have a look on “this” keyword. 

The "this" keyword is a special type of reference variable that is implicitly defined within each constructor and non-static method as a first parameter of the type class in which it is defined. For example, consider the following class written in C#. 

12. Define Property in 


Properties are members that provide a flexible mechanism to read, write or compute the values of private fields, in other words by the property we can access private fields. In other words we can say that a property is a return type function/method with one parameter or without a parameter. These are always public data members. It uses methods to access and assign values to private fields called accessors. 

Now question is what are accessors? 

The get and set portions or blocks of a property are called accessors. These are useful to restrict the accessibility of a property, the set accessor specifies that we can assign a value to a private field in a property and without the set accessor property it is like a read-only field. By the get accessor we can access the value of the private field, in other words it returns a single value. A Get accessor specifies that we can access the value of a field publically. 

We have the three types of properties 

• Read/Write.

• ReadOnly.

• WriteOnly

13. What is extension method in c# and how to use them? 


Extension methods enable you to add methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type. An extension method is a special kind of static method, but they are called as if they were instance methods on the extended type. 

What is the difference between dispose and finalize methods in c#? 

Answer: finalizer and dispose both are used for same task like to free unmanaged resources but have some differences see. 

Finalize: • Finalize used to free unmanaged resources those are not in use like files, database connections in application domain and more, held by an object before that object is destroyed. 

• In the Internal process it is called by Garbage Collector and can’t called manual by user code or any service. 

• Finalize belongs to System.Object class.

• Implement it when you have unmanaged resources in your code, and make sure that these resources are freed when the Garbage collection happens. 


• Dispose is also used to free unmanaged resources those are not in use like files, database connections in Application domain at any time. 

• Dispose explicitly it is called by manual user code.

• If we need to dispose method so must implement that class by IDisposable interface.

• It belongs to IDisposable interface.

• Implement this when you are writing a custom class that will be used by other users.

15. What is the difference between string and StringBuilder in c#?


StringBuilder and string both use to store string value but both have many differences on the bases of instance creation and also for performance: 


String is an immutable object. Immutable like when we create string object in code so we cannot modify or change that object in any operations like insert new value, replace or append any value with existing value in string object, when we have to do some operations to change string simply it will dispose the old value of string object and it will create new instance in memory for hold the new value in string object like: 


• It’s an immutable object that hold string value.

• Performance wise string is slow because its’ create a new instance to override or change the previous value.

• String belongs to System namespace.


System.Text.Stringbuilder is mutable object which also hold the string value, mutable means once we create a System.Text.Stringbuilder object we can use this object for any operation like insert value in existing string with insert functions also replace or append without creating new instance of System.Text.Stringbuilder for every time so it’s use the previous object so it’s work fast as compare than System.String. Let’s have an example to understand System.Text.Stringbuilder like: 


• StringBuilder is a mutable object.

• Performance wise StringBuilder is very fast because it will use same instance of StringBuilder object to perform any operation like insert value in existing string. 

• StringBuilder belongs to System.Text.Stringbuilder namespace. 

16. What is delegates in C# and uses of delegates? 


C# delegates are same as pointers to functions, in C or C++. A delegate Object is a reference type variable that use to holds the reference to a method. The reference can be changed at runtime which is hold by an object of delegate, a delegate object can hold many functions reference which is also known as Invocation List that refers functions in a sequence FIFO, we can new functions ref in this list at run time by += operator and can remove by -= operator. 

Delegates are especially used for implementing events and the call-back methods. All delegates are implicitly derived from the System.Delegate class. 

Let’s see how to use Delegate with Example: 

17. What is sealed class in c#? 


Sealed classes are used to restrict the inheritance feature of object oriented programming. Once a class is defined as a sealed class, the class cannot be inherited. 

In C#, the sealed modifier is used to define a class as sealed. In Visual Basic .NET the Not Inheritable keyword serves the purpose of sealed. If a class is derived from a sealed class then the compiler throws an error. 

If you have ever noticed, structs are sealed. You cannot derive a class from a struct. 

The following class definition defines a sealed class in C#: 

1. // Sealed class 

2. sealed class SealedClass 

3. { 


5. } 

18. What are partial classes?


A partial class is only use to splits the definition of a class in two or more classes in a same source code file or more than one source files. You can create a class definition in multiple files but it will be compiled as one class at run time and also when you’ll create an instance of this class so you can access all the methods from all source file with a same object. 

Partial Classes can be create in the same namespace it’s doesn’t allowed to create a partial class in different namespace. So use “partial” keyword with all the class name which you want to bind together with the same name of class in same namespace, let’s have an example: 

19. What is boxing and unboxing? 


Boxing and Unboxing both using for type converting but have some difference: 


Boxing is the process of converting a value type data type to the object or to any interface data type which is implemented by this value type. When the CLR boxes a value means when CLR converting a value type to Object Type, it wraps the value inside a System.Object and stores it on the heap area in application domain. 



Unboxing is also a process which is use to extracts the value type from the object or any implemented interface type. Boxing may be done implicit but unboxing have to be explicit by code. 


20. What is IEnumerable<> in c#? 


IEnumerable is the parent interface for all non-generic collections in System.Collections namespace like ArrayList, HastTable etc. that can be enumerated. For the generic version of this interface as IEnumerable which a parent interface of all generic collections class in System.Collections.Generic namespace like List<> and more. 

In System.Collections.Generic.IEnumerable have only a single method which is GetEnumerator() that returns an IEnumerator. IEnumerator provides the power to iterate through the collection by exposing a Current property and Move Next and Reset methods, if we doesn’t have this interface as a parent so we can’t use iteration by foreach loop or can’t use that class object in our LINQ query. 

21. What is difference between late binding and early binding in c#? 


Early Binding and Late Binding concepts belongs to polymorphism so let’s see first about polymorphism: 

Polymorphism is an ability to take more than one form of a function means with a same name we can write multiple functions code in a same class or any derived class. 

Polymorphism we have 2 different types to achieve that: 

• Compile Time also known as Early Binding or Overloading.

• Run Time also known as Late Binding or Overriding.

Compile Time Polymorphism or Early Binding:

In Compile time polymorphism or Early Binding we will use multiple methods with same name but different type of parameter or may be the number or parameter because of this we can perform different-different tasks with same method name in the same class which is also known as Method overloading. 

See how we can do that by the following example: 

Run Time Polymorphism or Late Binding: 

Run time polymorphism also known as late binding, in Run Time polymorphism or Late Binding we can do use same method names with same signatures means same type or same number of parameters but not in same class because compiler doesn’t allowed that at compile time so we can use in derived class that bind at run time when a child class or derived class object will instantiated that’s way we says that Late Binding. For that we have to create my parent class functions as partial and in driver or child class as override functions with override keyword. 

22. What are the differences between IEnumerable and IQueryable? 


Before the differences learn what is IEnumerable and IQueryable. 


Is the parent interface for all non-generic collections in System.Collections namespace like ArrayList, HastTable etc. that can be enumerated. For the generic version of this interface as IEnumerable which a parent interface of all generic collections class in System.Collections.Generic namespace like List<> and more. 


As per MSDN IQueryable interface is intended for implementation by query providers. It is only supposed to be implemented by providers that also implement IQueryable. If the provider does not also implement IQueryable, the standard query operators cannot be used on the provider's data source. 

The IQueryable interface inherits the IEnumerable interface so that if it represents a query, the results of that query can be enumerated. Enumeration causes the expression tree associated with an IQueryable object to be executed. The definition of "executing an expression tree" is specific to a query provider. For example, it may involve translating the expression tree to an appropriate query language for the underlying data source. Queries that do not return enumerable results are executed when the Execute method is called.

Source: Contents are provided by Technicalsymposium Google Group Members. 
Disclaimer: All the above contents are provided by Google Group members. 
Further, this content is not intended to be used for commercial purpose. is not liable/responsible for any copyright issues.

Download Technical Interview Materials PDF-Free Download

Technical Interview Questions and Answers Notes PDF
Placement Materials PDF-Free Download Study Materials PDF-Free Download Live Support-Chat with Our Experts

Official Contact: +91-9245556793 (Whatsapp Message / SMS / Voice Call)

Our Expert team is ready to answer all your questions immediately-Feel free to speak in Tamil/English.

(Example:Events info/Lecture Notes/Off-Campus & All Jobs/Projects & All education information)

Working hrs (IST): (Morning: 10:00AM-3:00 PM) and (Evening:5:00 PM to 10:00 PM)

All Latest Question & Answer Page (FAQ)-Click here