public static Type AsRuntimeType(this ITypeInformation typeInformation) { ArgumentUtility.CheckNotNull("typeInformation", typeInformation); if (!s_typeConversionProvider.CanConvert(typeInformation.GetType(), typeof(Type))) { return(null); } return(s_typeConversionProvider.Convert(typeInformation.GetType(), typeof(Type), typeInformation) as Type); }
public static Type ConvertToRuntimeType(this ITypeInformation typeInformation) { ArgumentUtility.CheckNotNull("typeInformation", typeInformation); if (!s_typeConversionProvider.CanConvert(typeInformation.GetType(), typeof(Type))) { throw new InvalidOperationException( string.Format( "The type '{0}' cannot be converted to a runtime type because no conversion is registered for '{1}'.", typeInformation.Name, typeInformation.GetType())); } return((Type)s_typeConversionProvider.Convert(typeInformation.GetType(), typeof(Type), typeInformation)); }