using System; using System.Reflection; namespace Google.Protobuf.Reflection { // Token: 0x0200006C RID: 108 internal sealed class SingleFieldAccessor : FieldAccessorBase { // Token: 0x060005FE RID: 1534 RVA: 0x00014FD4 File Offset: 0x000131D4 internal SingleFieldAccessor(PropertyInfo property, FieldDescriptor descriptor) : base(property, descriptor) { if (!property.CanWrite) { throw new ArgumentException("Not all required properties/methods available"); } this.setValueDelegate = ReflectionUtil.CreateActionIMessageObject(property.GetSetMethod()); Type propertyType = property.PropertyType; object defaultValue = ((descriptor.FieldType == FieldType.Message) ? null : ((propertyType == typeof(string)) ? "" : ((propertyType == typeof(ByteString)) ? ByteString.Empty : Activator.CreateInstance(propertyType)))); this.clearDelegate = delegate(IMessage message) { this.SetValue(message, defaultValue); }; } // Token: 0x060005FF RID: 1535 RVA: 0x00015074 File Offset: 0x00013274 public override void Clear(IMessage message) { this.clearDelegate(message); } // Token: 0x06000600 RID: 1536 RVA: 0x00015082 File Offset: 0x00013282 public override void SetValue(IMessage message, object value) { this.setValueDelegate(message, value); } // Token: 0x04000262 RID: 610 private readonly Action setValueDelegate; // Token: 0x04000263 RID: 611 private readonly Action clearDelegate; } }