protected override void BuildConstantsInternal(ReaderConstantsBuilderContext context) { context.SetFields(Type, new[] { new KeyValuePair <string, Type>("setters_" + Type.Name + "_" + Guid.NewGuid(), typeof(IntPtr[])), new KeyValuePair <string, Type>("delegates_" + Type.Name + "_" + Guid.NewGuid(), typeof(Delegate[])), new KeyValuePair <string, Type>("hashCodes_" + Type.Name + "_" + Guid.NewGuid(), typeof(ulong[])), }); foreach (var member in context.GetDataMembers(Type)) { Type memberType; switch (member.Member.MemberType) { case MemberTypes.Property: memberType = ((PropertyInfo)member.Member).PropertyType; break; case MemberTypes.Field: memberType = ((FieldInfo)member.Member).FieldType; break; default: throw new NotSupportedException("Data member of type " + member.Member.MemberType + " is not supported"); } context.BuildConstants(memberType); } }
protected override void BuildConstantsInternal(ReaderConstantsBuilderContext context) { context.SetFields(Type, new[] { new KeyValuePair <string, Type>("readers_" + Type.Name + "_" + Guid.NewGuid(), typeof(IntPtr[])), new KeyValuePair <string, Type>("delegates_" + Type.Name + "_" + Guid.NewGuid(), typeof(Delegate[])), }); }
protected override void BuildConstantsInternal(ReaderConstantsBuilderContext context) { context.SetFields(Type, new[] { new KeyValuePair <string, Type>("readers_" + Type.Name + "_" + Guid.NewGuid(), typeof(IntPtr[])), new KeyValuePair <string, Type>("delegates_" + Type.Name + "_" + Guid.NewGuid(), typeof(Delegate[])) // This field is needed only to save references to the dynamic methods. Otherwise GC will destroy them }); Array.ForEach(GroBufHelpers.LeafTypes.Where(type => type != null).ToArray(), type => context.BuildConstants(type)); }
protected override void BuildConstantsInternal(ReaderConstantsBuilderContext context) { context.SetFields(Type, new[] { new KeyValuePair <string, Type>("values_" + Type.Name + "_" + Guid.NewGuid(), typeof(int[])), new KeyValuePair <string, Type>("hashCodes_" + Type.Name + "_" + Guid.NewGuid(), typeof(ulong[])), }); context.BuildConstants(typeof(int)); context.BuildConstants(typeof(string)); }
protected override void BuildConstantsInternal(ReaderConstantsBuilderContext context) { context.SetFields(Type, new[] { new KeyValuePair <string, Type>("customSerializer_" + Type.Name + "_" + Guid.NewGuid(), typeof(IGroBufCustomSerializer)) }); }
public void BuildConstants(ReaderConstantsBuilderContext context) { context.SetFields(Type, new KeyValuePair <string, Type> [0]); BuildConstantsInternal(context); }