WSDL means Web Services Description Language.It is written in XML and it is used to describe a web service. It provides details about location of service and methods of service.
Handling “Cannot read configuration file due to insufficient permissions” error while hosting a website using IIS
When you are hosting a website using IIS you may get an error like this.
Explain about using keyword
How do you convert int to char in C#? Ex: print 1 as character on console
int x=4;
char c=(char)x;
it would not print ‘4’ on screen. It would display the ASCII corresponding value of ‘4’.
I tried this way…
int x=48;
string str =x.ToString();
char c=str[0];//for printing 4;
char c1=str[1];// for printing 8;
Tell about abstract class
Abstract classes are defined as classes using the modifier “abstract”. When we want a class to be base class and we don’t want to instantiate we use abstract classes. Many a times abstract classes are either partially implemented or not at all implemented.
An abstract class can contain either abstract methods or non abstract methods. Abstract members do not have any implementation in the abstract class, but the same has to be provided in its derived class.
An abstract class cannot be sealed class. We can have abstract methods only in abstract classes. We should use same access modifier for an abstract method in both base class and derived class to avoid compilation errors.
An abstract method cannot have virtual as it is implicitly virtual.
Explain Events
Events enable a class or object to notify other classes or objects when something of interest occurs. The class that sends (or raises) the event is called the publisher and the classes that receive (or handle) the event are called subscribers.
Events use delegates and limit communication to only one way. The subscribers only can listen and cannot modify the publisher.
Explain Delegates
A delegate is a type safe function pointer, it holds a reference to a function. The signature of the delegate must match the signature of the function, the delegate points to. A delegate is similar to a class and we can create an instance of it. Delegates are mainly used for communication and callbacks.
Delegates provide two way communication.
We can use multi cast delegates when we need to reference more than one function. When we invoke a multi-cast delegate, all the functions the delegate is pointing to, are invoked.
Explain about generics?
Generics are introduced in C# 2.0, they allow us to design classes and methods decoupled from data types. We can make use of generics and increase code reuse, type safety and performance.
What is a constructor and types of constructors?
When we create a class or struct, its constructor is called. Constructor will have same name as a class or struct and is usually used to initialize the data members of the new object. There are three types of constructors:
Instance constructors are used to create and initialize any instance member variables when we use new expression to create an object of a class.
Static constructors are used to initialize static data or to perform actions that need to be performed only once. It is called automatically before first instance is created or any of the static members are referenced.
Private constructors are only used when a class contains only static members.
What is the difference between Var and Dynamic in C#?
“Var” is statistically typed,this means type of variable declared is decided by compiler at compile time.This type of variables should be initialized at the time of declaration.
“Dynamic” is dynamically typed ,this means the type of variable declared is decided by compiler at run time.This type of variables are need not be initialized.