Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ StoreMember()

void System.Runtime.Serialization.CodeGenerator.StoreMember ( MemberInfo memberInfo)
inlinepackage

Definition at line 691 of file CodeGenerator.cs.

692 {
694 {
696 if (fieldInfo.IsStatic)
697 {
698 if (_codeGenTrace != 0)
699 {
700 EmitSourceInstruction("Stsfld " + fieldInfo?.ToString() + " on type " + fieldInfo.DeclaringType);
701 }
703 }
704 else
705 {
706 if (_codeGenTrace != 0)
707 {
708 EmitSourceInstruction("Stfld " + fieldInfo?.ToString() + " on type " + fieldInfo.DeclaringType);
709 }
711 }
712 }
713 else if (memberInfo is PropertyInfo)
714 {
715 PropertyInfo propertyInfo = memberInfo as PropertyInfo;
716 if (propertyInfo != null)
717 {
718 MethodInfo setMethod = propertyInfo.SetMethod;
719 if (setMethod == null)
720 {
721 throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(System.SR.Format(System.SR.NoSetMethodForProperty, propertyInfo.DeclaringType, propertyInfo)));
722 }
724 }
725 }
726 else
727 {
728 if (!(memberInfo is MethodInfo))
729 {
730 throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(System.SR.Format(System.SR.CannotLoadMemberType, "Unknown")));
731 }
733 }
734 }
virtual void Emit(OpCode opcode)
static readonly OpCode Stsfld
Definition OpCodes.cs:255
static readonly OpCode Stfld
Definition OpCodes.cs:249
virtual ? MethodInfo SetMethod
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string NoSetMethodForProperty
Definition SR.cs:218
static string CannotLoadMemberType
Definition SR.cs:22
Definition SR.cs:7

References System.Runtime.Serialization.CodeGenerator._codeGenTrace, System.Runtime.Serialization.CodeGenerator._ilGen, System.Reflection.Emit.Call, System.SR.CannotLoadMemberType, System.Runtime.Serialization.XmlObjectSerializer.CreateSerializationException(), System.Reflection.MemberInfo.DeclaringType, System.Reflection.Emit.ILGenerator.Emit(), System.Runtime.Serialization.CodeGenerator.EmitSourceInstruction(), System.SR.Format(), System.SR.NoSetMethodForProperty, System.Reflection.PropertyInfo.SetMethod, System.Reflection.Emit.OpCodes.Stfld, System.Reflection.Emit.OpCodes.Stsfld, System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(), and System.ToString.

Referenced by System.Runtime.Serialization.Json.JsonFormatReaderGenerator.CriticalHelper.ReadMembers(), and System.Runtime.Serialization.XmlFormatReaderGenerator.CriticalHelper.ReadMembers().