public static Tuple<string, string> Generate(TypeInfo type) { Func<string> wrapperString = () => { var code = new CodeCompileUnit(); var ns = createNamespace(type); code.Namespaces.Add(ns); var wrap = new CodeTypeDeclaration(type.Name + "Wrap"); wrap.IsClass = true; wrap.TypeAttributes = TypeAttributes.Public | TypeAttributes.Class; ns.Types.Add(wrap); enrichWrapType(wrap, type.GetTypeInfo()); return generateCSharpCode(code); }; Func<string> interfaceString = () => { var code = new CodeCompileUnit(); var ns = createNamespace(type); code.Namespaces.Add(ns); var intf = new CodeTypeDeclaration("I" + type.Name); intf.IsClass = false; intf.TypeAttributes = TypeAttributes.Public | TypeAttributes.Interface; ns.Types.Add(intf); return generateCSharpCode(code); }; return Tuple.Create(wrapperString(), interfaceString()); }
public static TP GetTypeInfo ( TP type ) { #if NETFX_CORE return type.GetTypeInfo(); #else return type; #endif }
public static TP GetTypeInfo(TP type) { #if NETFX_CORE return(type.GetTypeInfo()); #else return(type); #endif }