static string fieldNamesWithType(MemberTypeNameInfo[] infos)
        {
            var typedArgs = infos.Select(info => {
                var newArg     = "new" + info.name.UppercaseFirst();
                var typeString = TypeGenerator.Generate(info.type);
                return(typeString + " " + newArg);
            }).ToArray();

            return(string.Join(", ", typedArgs));
        }
Beispiel #2
0
        static string fieldNamesWithType(FieldInfo[] fields)
        {
            var typedArgs = fields.Select(arg => {
                var newArg = "new" + arg.Name.UppercaseFirst();
                var type   = TypeGenerator.Generate(arg.FieldType);
                return(type + " " + newArg);
            }).ToArray();

            return(string.Join(", ", typedArgs));
        }
        static string addComponentTypes(Type[] components)
        {
            const string FORMAT = "        typeof({1}),\n";
            var          code   = string.Empty;

            for (int i = 0; i < components.Length; i++)
            {
                var type = components[i];
                if (type != null)
                {
                    code += string.Format(FORMAT, i, TypeGenerator.Generate(type));
                }
            }
            if (code.EndsWith(",\n"))
            {
                code = code.Remove(code.Length - 2) + "\n";
            }

            return(string.Format(@"

    public static readonly System.Type[] componentTypes = {{
{0}    }};", code));
        }