google search

Friday, February 25, 2011

Interface

An interface contains only the signatures of methods, delegates or events. The implementation of the methods is done in the class that implements the interface, as shown in the following example:

 

 

      interface ISampleInterface

{

    void SampleMethod();

}

 

class ImplementationClass : ISampleInterface

{

    // Explicit interface member implementation:

    void ISampleInterface.SampleMethod()

    {

        // Method implementation.

    }

 

    static void Main()

    {

        // Declare an interface instance.

        ISampleInterface obj = new ImplementationClass();

 

        // Call the member.

        obj.SampleMethod();

    }

}

 

An interface can be a member of a namespace or a class and can contain signatures of the following members:

 

Methods

Properties

Indexers

Events

 

An interface can inherit from one or more base interfaces.

 

When a base type list contains a base class and interfaces, the base class must come first in the list.

 

A class that implements an interface can explicitly implement members of that interface. An explicitly implemented member cannot be accessed through a class instance, but only through an instance of the interface

 

Monday, February 21, 2011

Interview Questions

1.What is the difference between virtual directory and website?

For website we can assign an IP address where virtual directory will not have this property.
One website can have multiple virtual directories.

2.What is static class?
a.For static class we can create the object(instance)
b.We can use the method by calls name dot.
c.Static class used to share same information in entire site.
d.Static class is available in C# only