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

◆ GenerateCreateXmlSerializableDelegate()

CreateXmlSerializableDelegate System.Runtime.Serialization.XmlDataContract.GenerateCreateXmlSerializableDelegate ( )
inlinepackage

Definition at line 315 of file XmlDataContract.cs.

316 {
317 Type underlyingType = base.UnderlyingType;
319 bool flag = RequiresMemberAccessForCreate(null) && !(underlyingType.FullName == "System.Xml.Linq.XElement");
320 try
321 {
322 codeGenerator.BeginMethod("Create" + DataContract.GetClrTypeFullName(underlyingType), typeof(CreateXmlSerializableDelegate), flag);
323 }
325 {
326 if (!flag)
327 {
328 throw;
329 }
331 }
332 if (underlyingType.IsValueType)
333 {
338 }
339 else
340 {
342 if (!constructorInfo.IsPublic && underlyingType.FullName == "System.Xml.Linq.XElement")
343 {
344 Type type = underlyingType.Assembly.GetType("System.Xml.Linq.XName");
345 if (type != null)
346 {
347 MethodInfo method = type.GetMethod("op_Implicit", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, new Type[1] { typeof(string) });
348 ConstructorInfo constructor = underlyingType.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, new Type[1] { type });
349 if (method != null && constructor != null)
350 {
351 codeGenerator.Ldstr("default");
352 codeGenerator.Call(method);
354 }
355 }
356 }
358 }
359 codeGenerator.ConvertValue(base.UnderlyingType, Globals.TypeOfIXmlSerializable);
360 codeGenerator.Ret();
361 return (CreateXmlSerializableDelegate)codeGenerator.EndMethod();
362 }
DataContract(DataContractCriticalHelper helper)
bool RequiresMemberAccessForCreate(SecurityException securityException)

References System.Runtime.Serialization.Dictionary, System.Runtime.Serialization.DataContract.GetClrTypeFullName(), System.Runtime.Serialization.XmlDataContract.GetConstructor(), System.Runtime.Serialization.XmlDataContract.RequiresMemberAccessForCreate(), System.type, and System.Runtime.Serialization.Globals.TypeOfIXmlSerializable.