Horje
return an interface or a class C# Code Example
return an interface or a class C#
// The return of interface as an instance of that interface
// Ff the instance has a few instances then no need to worry about the type of instance
// This example returns an object that has implemented Ic
public interface Ic
{
    int Type { get; }
    string Name { get; }
}

public class A : Ic
{
}

public class B : Ic
{
}

public Ic func(bool flag)
{
     if (flag)
         return new A();
       return new B();

}




Csharp

Related
batchblock timeout Code Example batchblock timeout Code Example
c# set cursor to loading and back Code Example c# set cursor to loading and back Code Example
c# invokerequired wpf Code Example c# invokerequired wpf Code Example
asp c# page scroll position change after postback Code Example asp c# page scroll position change after postback Code Example
how to pause a console.writeline in C# Code Example how to pause a console.writeline in C# Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8