Esempio n. 1
0
 public override void writeObject(ExportContext ctx, object value, TypeData[] typeArgs = null)
 {
     string s = Enum.GetName(_type, value);
     if (s == null) {
     throw new ArgumentException("Enum value has no name: " + _type + ": " + value);
     }
     ctx.writeString(s);
 }
Esempio n. 2
0
 public override void writeObject(ExportContext ctx, object value, TypeData[] typeArguments = null)
 {
     ctx.writeString((string)value);
 }
            public void writeField(
                ExportContext ctx, ExportingReflectiveTypeData sourceTypeData, object source)
            {
                if (_fieldId == -1) {
                _fieldId = sourceTypeData.getNextFieldId();
                //                this.logInfo("Writing new field",
                //                        "fieldId", _fieldId,
                //                        "name", _name,
                //                        "type", _type);
                ctx.writeId(_fieldId);
                ctx.writeString(_name);
                ctx.writeType(_type);

                } else {
                ctx.writeId(_fieldId);
                }
                ctx.writeObject(_field.GetValue(source), _type);
            }