Labels

Thursday, October 7, 2010

IsAssignableFrom

This is about checking the glue between Interface and Class Implementing the Interface.

 

 

public interface ISilverlightClientConfigProvider

{

    object GetClientConfigBlock(string moduleHint, string configBlockName);

}

 

 

public class UserProfileConfigProvider : ISilverlightClientConfigProvider

{

  // Code Here

}

 

public class EndPointConfigProvider : ISilverlightClientConfigProvider

{

  // Code Here

}

 

String str = "CTLS.ICLS.UX.ClientConfigProviders.UserProfileConfigProvider";

 

Type c = Type.GetType(str, true, true);

if (typeof(ISilverlightClientConfigProvider).IsAssignableFrom(c))

{

  ISilverlightClientConfigProvider provider = Activator.CreateInstance(c) as ISilverlightClientConfigProvider;

  if (null != provider)

  {}

}

 

 

Hope this helps.


Arun Manglick

No comments:

Post a Comment