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

◆ GetBuiltInDataContract() [2/3]

static DataContract System.Runtime.Serialization.DataContract.DataContractCriticalHelper.GetBuiltInDataContract ( string typeName)
inlinestaticinherited

Definition at line 527 of file DataContract.cs.

528 {
529 if (!typeName.StartsWith("System.", StringComparison.Ordinal))
530 {
531 return null;
532 }
534 {
535 if (s_nameToBuiltInContract == null)
536 {
538 }
539 XmlQualifiedName key = new XmlQualifiedName(typeName);
540 if (!s_nameToBuiltInContract.TryGetValue(key, out var value))
541 {
542 Type type = null;
543 switch (typeName.Substring(7))
544 {
545 case "Char":
546 type = typeof(char);
547 break;
548 case "Boolean":
549 type = typeof(bool);
550 break;
551 case "SByte":
552 type = typeof(sbyte);
553 break;
554 case "Byte":
555 type = typeof(byte);
556 break;
557 case "Int16":
558 type = typeof(short);
559 break;
560 case "UInt16":
561 type = typeof(ushort);
562 break;
563 case "Int32":
564 type = typeof(int);
565 break;
566 case "UInt32":
567 type = typeof(uint);
568 break;
569 case "Int64":
570 type = typeof(long);
571 break;
572 case "UInt64":
573 type = typeof(ulong);
574 break;
575 case "Single":
576 type = typeof(float);
577 break;
578 case "Double":
579 type = typeof(double);
580 break;
581 case "Decimal":
582 type = typeof(decimal);
583 break;
584 case "DateTime":
586 break;
587 case "String":
588 type = typeof(string);
589 break;
590 case "Byte[]":
591 type = typeof(byte[]);
592 break;
593 case "Object":
594 type = typeof(object);
595 break;
596 case "TimeSpan":
598 break;
599 case "Guid":
600 type = typeof(Guid);
601 break;
602 case "Uri":
603 type = typeof(Uri);
604 break;
605 case "Xml.XmlQualifiedName":
607 break;
608 case "Enum":
609 type = typeof(Enum);
610 break;
611 case "ValueType":
612 type = typeof(ValueType);
613 break;
614 case "Array":
615 type = typeof(Array);
616 break;
617 case "Xml.XmlElement":
619 break;
620 case "Xml.XmlNode[]":
621 type = typeof(XmlNode[]);
622 break;
623 }
624 if (type != null)
625 {
627 }
629 }
630 return value;
631 }
632 }
static bool TryCreateBuiltInDataContract(Type type, [NotNullWhen(true)] out DataContract dataContract)
static Dictionary< XmlQualifiedName, DataContract > s_nameToBuiltInContract

References System.Runtime.Serialization.Dictionary, System.key, System.Runtime.Serialization.DataContract.DataContractCriticalHelper.s_initBuiltInContractsLock, System.Runtime.Serialization.DataContract.DataContractCriticalHelper.s_nameToBuiltInContract, System.Runtime.Serialization.DataContract.DataContractCriticalHelper.TryCreateBuiltInDataContract(), System.type, and System.value.