public static FieldGenerator Field(AccessModifier scope, FieldModifier modifier, Type type, string name)
        {
            var field = new FieldGenerator();

            field.scope        = scope;
            field.modifier     = modifier;
            field.type         = type;
            field.name         = name.LegalMemberName();
            field.defaultValue = type.Default();
            return(field);
        }
        public static FieldGenerator Field(AccessModifier scope, FieldModifier modifier, string typeName, string typeNamespace, string name, string defaultValue = null, HighlightType highlightType = HighlightType.None)
        {
            var field = new FieldGenerator();

            field.scope               = scope;
            field.modifier            = modifier;
            field.typeIsString        = true;
            field.stringTypeNamespace = typeNamespace.SlashesToPeriods();
            field.stringType          = typeName;
            field.name          = name.LegalMemberName();
            field.highlightType = highlightType;
            return(field);
        }
示例#3
0
 /// <summary>
 /// Add a field to this class.
 /// </summary>
 public ClassGenerator AddField(FieldGenerator generator)
 {
     fields.Add(generator);
     return(this);
 }
 public StructGenerator AddField(FieldGenerator generator)
 {
     fields.Add(generator);
     return(this);
 }