| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289 |
- //-----------------------------------------------------------------------------
- // Copyright (c) Microsoft Corporation. All rights reserved.
- //-----------------------------------------------------------------------------
- namespace System.Runtime.Serialization
- {
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Reflection;
- using System.Security;
- using System.Security.Permissions;
- using System.Xml;
- using System.Xml.Schema;
- using System.Xml.Serialization;
- [Fx.Tag.SecurityNote(Critical = "Class holds static instances used in serializer. "
- + "Static fields are marked SecurityCritical or readonly to prevent "
- + "data from being modified or leaked to other components in appdomain.",
- Safe = "All get-only properties marked safe since they only need to be protected for write.")]
- static class Globals
- {
- [Fx.Tag.SecurityNote(Miscellaneous = "RequiresReview - Changes to const could affect code generation logic; any changes should be reviewed.")]
- internal const BindingFlags ScanAllMembers = BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public;
- [SecurityCritical]
- static XmlQualifiedName idQualifiedName;
- internal static XmlQualifiedName IdQualifiedName
- {
- [SecuritySafeCritical]
- get
- {
- if (idQualifiedName == null)
- idQualifiedName = new XmlQualifiedName(Globals.IdLocalName, Globals.SerializationNamespace);
- return idQualifiedName;
- }
- }
- [SecurityCritical]
- static XmlQualifiedName refQualifiedName;
- internal static XmlQualifiedName RefQualifiedName
- {
- [SecuritySafeCritical]
- get
- {
- if (refQualifiedName == null)
- refQualifiedName = new XmlQualifiedName(Globals.RefLocalName, Globals.SerializationNamespace);
- return refQualifiedName;
- }
- }
- [SecurityCritical]
- static Type typeOfObject;
- internal static Type TypeOfObject
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfObject == null)
- typeOfObject = typeof(object);
- return typeOfObject;
- }
- }
- [SecurityCritical]
- static Type typeOfValueType;
- internal static Type TypeOfValueType
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfValueType == null)
- typeOfValueType = typeof(ValueType);
- return typeOfValueType;
- }
- }
- [SecurityCritical]
- static Type typeOfArray;
- internal static Type TypeOfArray
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfArray == null)
- typeOfArray = typeof(Array);
- return typeOfArray;
- }
- }
- [SecurityCritical]
- static Type typeOfString;
- internal static Type TypeOfString
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfString == null)
- typeOfString = typeof(string);
- return typeOfString;
- }
- }
- [SecurityCritical]
- static Type typeOfInt;
- internal static Type TypeOfInt
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfInt == null)
- typeOfInt = typeof(int);
- return typeOfInt;
- }
- }
- [SecurityCritical]
- static Type typeOfULong;
- internal static Type TypeOfULong
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfULong == null)
- typeOfULong = typeof(ulong);
- return typeOfULong;
- }
- }
- [SecurityCritical]
- static Type typeOfVoid;
- internal static Type TypeOfVoid
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfVoid == null)
- typeOfVoid = typeof(void);
- return typeOfVoid;
- }
- }
- [SecurityCritical]
- static Type typeOfByteArray;
- internal static Type TypeOfByteArray
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfByteArray == null)
- typeOfByteArray = typeof(byte[]);
- return typeOfByteArray;
- }
- }
- [SecurityCritical]
- static Type typeOfTimeSpan;
- internal static Type TypeOfTimeSpan
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfTimeSpan == null)
- typeOfTimeSpan = typeof(TimeSpan);
- return typeOfTimeSpan;
- }
- }
- [SecurityCritical]
- static Type typeOfGuid;
- internal static Type TypeOfGuid
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfGuid == null)
- typeOfGuid = typeof(Guid);
- return typeOfGuid;
- }
- }
- [SecurityCritical]
- static Type typeOfDateTimeOffset;
- internal static Type TypeOfDateTimeOffset
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfDateTimeOffset == null)
- typeOfDateTimeOffset = typeof(DateTimeOffset);
- return typeOfDateTimeOffset;
- }
- }
- [SecurityCritical]
- static Type typeOfDateTimeOffsetAdapter;
- internal static Type TypeOfDateTimeOffsetAdapter
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfDateTimeOffsetAdapter == null)
- typeOfDateTimeOffsetAdapter = typeof(DateTimeOffsetAdapter);
- return typeOfDateTimeOffsetAdapter;
- }
- }
- [SecurityCritical]
- static Type typeOfUri;
- internal static Type TypeOfUri
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfUri == null)
- typeOfUri = typeof(Uri);
- return typeOfUri;
- }
- }
- [SecurityCritical]
- static Type typeOfTypeEnumerable;
- internal static Type TypeOfTypeEnumerable
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfTypeEnumerable == null)
- typeOfTypeEnumerable = typeof(IEnumerable<Type>);
- return typeOfTypeEnumerable;
- }
- }
- [SecurityCritical]
- static Type typeOfStreamingContext;
- internal static Type TypeOfStreamingContext
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfStreamingContext == null)
- typeOfStreamingContext = typeof(StreamingContext);
- return typeOfStreamingContext;
- }
- }
- [SecurityCritical]
- static Type typeOfISerializable;
- internal static Type TypeOfISerializable
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfISerializable == null)
- typeOfISerializable = typeof(ISerializable);
- return typeOfISerializable;
- }
- }
- [SecurityCritical]
- static Type typeOfIDeserializationCallback;
- internal static Type TypeOfIDeserializationCallback
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfIDeserializationCallback == null)
- typeOfIDeserializationCallback = typeof(IDeserializationCallback);
- return typeOfIDeserializationCallback;
- }
- }
- [SecurityCritical]
- static Type typeOfIObjectReference;
- internal static Type TypeOfIObjectReference
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfIObjectReference == null)
- typeOfIObjectReference = typeof(IObjectReference);
- return typeOfIObjectReference;
- }
- }
- [SecurityCritical]
- static Type typeOfXmlFormatClassWriterDelegate;
- internal static Type TypeOfXmlFormatClassWriterDelegate
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfXmlFormatClassWriterDelegate == null)
- typeOfXmlFormatClassWriterDelegate = typeof(XmlFormatClassWriterDelegate);
- return typeOfXmlFormatClassWriterDelegate;
- }
- }
- [SecurityCritical]
- static Type typeOfXmlFormatCollectionWriterDelegate;
- internal static Type TypeOfXmlFormatCollectionWriterDelegate
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfXmlFormatCollectionWriterDelegate == null)
- typeOfXmlFormatCollectionWriterDelegate = typeof(XmlFormatCollectionWriterDelegate);
- return typeOfXmlFormatCollectionWriterDelegate;
- }
- }
- [SecurityCritical]
- static Type typeOfXmlFormatClassReaderDelegate;
- internal static Type TypeOfXmlFormatClassReaderDelegate
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfXmlFormatClassReaderDelegate == null)
- typeOfXmlFormatClassReaderDelegate = typeof(XmlFormatClassReaderDelegate);
- return typeOfXmlFormatClassReaderDelegate;
- }
- }
- [SecurityCritical]
- static Type typeOfXmlFormatCollectionReaderDelegate;
- internal static Type TypeOfXmlFormatCollectionReaderDelegate
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfXmlFormatCollectionReaderDelegate == null)
- typeOfXmlFormatCollectionReaderDelegate = typeof(XmlFormatCollectionReaderDelegate);
- return typeOfXmlFormatCollectionReaderDelegate;
- }
- }
- [SecurityCritical]
- static Type typeOfXmlFormatGetOnlyCollectionReaderDelegate;
- internal static Type TypeOfXmlFormatGetOnlyCollectionReaderDelegate
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfXmlFormatGetOnlyCollectionReaderDelegate == null)
- typeOfXmlFormatGetOnlyCollectionReaderDelegate = typeof(XmlFormatGetOnlyCollectionReaderDelegate);
- return typeOfXmlFormatGetOnlyCollectionReaderDelegate;
- }
- }
- [SecurityCritical]
- static Type typeOfKnownTypeAttribute;
- internal static Type TypeOfKnownTypeAttribute
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfKnownTypeAttribute == null)
- typeOfKnownTypeAttribute = typeof(KnownTypeAttribute);
- return typeOfKnownTypeAttribute;
- }
- }
- [Fx.Tag.SecurityNote(Critical = "Attribute type used in security decision.")]
- [SecurityCritical]
- static Type typeOfDataContractAttribute;
- internal static Type TypeOfDataContractAttribute
- {
- [Fx.Tag.SecurityNote(Critical = "Accesses critical field for attribute type.",
- Safe = "Controls inputs and logic.")]
- [SecuritySafeCritical]
- get
- {
- if (typeOfDataContractAttribute == null)
- typeOfDataContractAttribute = typeof(DataContractAttribute);
- return typeOfDataContractAttribute;
- }
- }
- [SecurityCritical]
- static Type typeOfContractNamespaceAttribute;
- internal static Type TypeOfContractNamespaceAttribute
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfContractNamespaceAttribute == null)
- typeOfContractNamespaceAttribute = typeof(ContractNamespaceAttribute);
- return typeOfContractNamespaceAttribute;
- }
- }
- [SecurityCritical]
- static Type typeOfDataMemberAttribute;
- internal static Type TypeOfDataMemberAttribute
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfDataMemberAttribute == null)
- typeOfDataMemberAttribute = typeof(DataMemberAttribute);
- return typeOfDataMemberAttribute;
- }
- }
- [SecurityCritical]
- static Type typeOfEnumMemberAttribute;
- internal static Type TypeOfEnumMemberAttribute
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfEnumMemberAttribute == null)
- typeOfEnumMemberAttribute = typeof(EnumMemberAttribute);
- return typeOfEnumMemberAttribute;
- }
- }
- [SecurityCritical]
- static Type typeOfCollectionDataContractAttribute;
- internal static Type TypeOfCollectionDataContractAttribute
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfCollectionDataContractAttribute == null)
- typeOfCollectionDataContractAttribute = typeof(CollectionDataContractAttribute);
- return typeOfCollectionDataContractAttribute;
- }
- }
- [SecurityCritical]
- static Type typeOfOptionalFieldAttribute;
- internal static Type TypeOfOptionalFieldAttribute
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfOptionalFieldAttribute == null)
- typeOfOptionalFieldAttribute = typeof(OptionalFieldAttribute);
- return typeOfOptionalFieldAttribute;
- }
- }
- [SecurityCritical]
- static Type typeOfObjectArray;
- internal static Type TypeOfObjectArray
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfObjectArray == null)
- typeOfObjectArray = typeof(object[]);
- return typeOfObjectArray;
- }
- }
- [SecurityCritical]
- static Type typeOfOnSerializingAttribute;
- internal static Type TypeOfOnSerializingAttribute
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfOnSerializingAttribute == null)
- typeOfOnSerializingAttribute = typeof(OnSerializingAttribute);
- return typeOfOnSerializingAttribute;
- }
- }
- [SecurityCritical]
- static Type typeOfOnSerializedAttribute;
- internal static Type TypeOfOnSerializedAttribute
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfOnSerializedAttribute == null)
- typeOfOnSerializedAttribute = typeof(OnSerializedAttribute);
- return typeOfOnSerializedAttribute;
- }
- }
- [SecurityCritical]
- static Type typeOfOnDeserializingAttribute;
- internal static Type TypeOfOnDeserializingAttribute
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfOnDeserializingAttribute == null)
- typeOfOnDeserializingAttribute = typeof(OnDeserializingAttribute);
- return typeOfOnDeserializingAttribute;
- }
- }
- [SecurityCritical]
- static Type typeOfOnDeserializedAttribute;
- internal static Type TypeOfOnDeserializedAttribute
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfOnDeserializedAttribute == null)
- typeOfOnDeserializedAttribute = typeof(OnDeserializedAttribute);
- return typeOfOnDeserializedAttribute;
- }
- }
- [SecurityCritical]
- static Type typeOfFlagsAttribute;
- internal static Type TypeOfFlagsAttribute
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfFlagsAttribute == null)
- typeOfFlagsAttribute = typeof(FlagsAttribute);
- return typeOfFlagsAttribute;
- }
- }
- [SecurityCritical]
- static Type typeOfSerializableAttribute;
- internal static Type TypeOfSerializableAttribute
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfSerializableAttribute == null)
- typeOfSerializableAttribute = typeof(SerializableAttribute);
- return typeOfSerializableAttribute;
- }
- }
- [SecurityCritical]
- static Type typeOfNonSerializedAttribute;
- internal static Type TypeOfNonSerializedAttribute
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfNonSerializedAttribute == null)
- typeOfNonSerializedAttribute = typeof(NonSerializedAttribute);
- return typeOfNonSerializedAttribute;
- }
- }
- [SecurityCritical]
- static Type typeOfSerializationInfo;
- internal static Type TypeOfSerializationInfo
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfSerializationInfo == null)
- typeOfSerializationInfo = typeof(SerializationInfo);
- return typeOfSerializationInfo;
- }
- }
- [SecurityCritical]
- static Type typeOfSerializationInfoEnumerator;
- internal static Type TypeOfSerializationInfoEnumerator
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfSerializationInfoEnumerator == null)
- typeOfSerializationInfoEnumerator = typeof(SerializationInfoEnumerator);
- return typeOfSerializationInfoEnumerator;
- }
- }
- [SecurityCritical]
- static Type typeOfSerializationEntry;
- internal static Type TypeOfSerializationEntry
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfSerializationEntry == null)
- typeOfSerializationEntry = typeof(SerializationEntry);
- return typeOfSerializationEntry;
- }
- }
- [SecurityCritical]
- static Type typeOfIXmlSerializable;
- internal static Type TypeOfIXmlSerializable
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfIXmlSerializable == null)
- typeOfIXmlSerializable = typeof(IXmlSerializable);
- return typeOfIXmlSerializable;
- }
- }
- [SecurityCritical]
- static Type typeOfXmlSchemaProviderAttribute;
- internal static Type TypeOfXmlSchemaProviderAttribute
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfXmlSchemaProviderAttribute == null)
- typeOfXmlSchemaProviderAttribute = typeof(XmlSchemaProviderAttribute);
- return typeOfXmlSchemaProviderAttribute;
- }
- }
- [SecurityCritical]
- static Type typeOfXmlRootAttribute;
- internal static Type TypeOfXmlRootAttribute
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfXmlRootAttribute == null)
- typeOfXmlRootAttribute = typeof(XmlRootAttribute);
- return typeOfXmlRootAttribute;
- }
- }
- [SecurityCritical]
- static Type typeOfXmlQualifiedName;
- internal static Type TypeOfXmlQualifiedName
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfXmlQualifiedName == null)
- typeOfXmlQualifiedName = typeof(XmlQualifiedName);
- return typeOfXmlQualifiedName;
- }
- }
- [SecurityCritical]
- static Type typeOfXmlSchemaType;
- internal static Type TypeOfXmlSchemaType
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfXmlSchemaType == null)
- typeOfXmlSchemaType = typeof(XmlSchemaType);
- return typeOfXmlSchemaType;
- }
- }
- [SecurityCritical]
- static Type typeOfXmlSerializableServices;
- internal static Type TypeOfXmlSerializableServices
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfXmlSerializableServices == null)
- typeOfXmlSerializableServices = typeof(XmlSerializableServices);
- return typeOfXmlSerializableServices;
- }
- }
- [SecurityCritical]
- static Type typeOfXmlNodeArray;
- internal static Type TypeOfXmlNodeArray
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfXmlNodeArray == null)
- typeOfXmlNodeArray = typeof(XmlNode[]);
- return typeOfXmlNodeArray;
- }
- }
- [SecurityCritical]
- static Type typeOfXmlSchemaSet;
- internal static Type TypeOfXmlSchemaSet
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfXmlSchemaSet == null)
- typeOfXmlSchemaSet = typeof(XmlSchemaSet);
- return typeOfXmlSchemaSet;
- }
- }
- [SecurityCritical]
- static object[] emptyObjectArray;
- internal static object[] EmptyObjectArray
- {
- [SecuritySafeCritical]
- get
- {
- if (emptyObjectArray == null)
- emptyObjectArray = new object[0];
- return emptyObjectArray;
- }
- }
- [SecurityCritical]
- static Type[] emptyTypeArray;
- internal static Type[] EmptyTypeArray
- {
- [SecuritySafeCritical]
- get
- {
- if (emptyTypeArray == null)
- emptyTypeArray = new Type[0];
- return emptyTypeArray;
- }
- }
- [SecurityCritical]
- static Type typeOfIPropertyChange;
- internal static Type TypeOfIPropertyChange
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfIPropertyChange == null)
- typeOfIPropertyChange = typeof(INotifyPropertyChanged);
- return typeOfIPropertyChange;
- }
- }
- [SecurityCritical]
- static Type typeOfIExtensibleDataObject;
- internal static Type TypeOfIExtensibleDataObject
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfIExtensibleDataObject == null)
- typeOfIExtensibleDataObject = typeof(IExtensibleDataObject);
- return typeOfIExtensibleDataObject;
- }
- }
- [SecurityCritical]
- static Type typeOfExtensionDataObject;
- internal static Type TypeOfExtensionDataObject
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfExtensionDataObject == null)
- typeOfExtensionDataObject = typeof(ExtensionDataObject);
- return typeOfExtensionDataObject;
- }
- }
- [SecurityCritical]
- static Type typeOfISerializableDataNode;
- internal static Type TypeOfISerializableDataNode
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfISerializableDataNode == null)
- typeOfISerializableDataNode = typeof(ISerializableDataNode);
- return typeOfISerializableDataNode;
- }
- }
- [SecurityCritical]
- static Type typeOfClassDataNode;
- internal static Type TypeOfClassDataNode
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfClassDataNode == null)
- typeOfClassDataNode = typeof(ClassDataNode);
- return typeOfClassDataNode;
- }
- }
- [SecurityCritical]
- static Type typeOfCollectionDataNode;
- internal static Type TypeOfCollectionDataNode
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfCollectionDataNode == null)
- typeOfCollectionDataNode = typeof(CollectionDataNode);
- return typeOfCollectionDataNode;
- }
- }
- [SecurityCritical]
- static Type typeOfXmlDataNode;
- internal static Type TypeOfXmlDataNode
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfXmlDataNode == null)
- typeOfXmlDataNode = typeof(XmlDataNode);
- return typeOfXmlDataNode;
- }
- }
- [SecurityCritical]
- static Type typeOfNullable;
- internal static Type TypeOfNullable
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfNullable == null)
- typeOfNullable = typeof(Nullable<>);
- return typeOfNullable;
- }
- }
- [SecurityCritical]
- static Type typeOfReflectionPointer;
- internal static Type TypeOfReflectionPointer
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfReflectionPointer == null)
- typeOfReflectionPointer = typeof(System.Reflection.Pointer);
- return typeOfReflectionPointer;
- }
- }
- [SecurityCritical]
- static Type typeOfIDictionaryGeneric;
- internal static Type TypeOfIDictionaryGeneric
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfIDictionaryGeneric == null)
- typeOfIDictionaryGeneric = typeof(IDictionary<,>);
- return typeOfIDictionaryGeneric;
- }
- }
- [SecurityCritical]
- static Type typeOfIDictionary;
- internal static Type TypeOfIDictionary
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfIDictionary == null)
- typeOfIDictionary = typeof(IDictionary);
- return typeOfIDictionary;
- }
- }
- [SecurityCritical]
- static Type typeOfIListGeneric;
- internal static Type TypeOfIListGeneric
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfIListGeneric == null)
- typeOfIListGeneric = typeof(IList<>);
- return typeOfIListGeneric;
- }
- }
- [SecurityCritical]
- static Type typeOfIList;
- internal static Type TypeOfIList
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfIList == null)
- typeOfIList = typeof(IList);
- return typeOfIList;
- }
- }
- [SecurityCritical]
- static Type typeOfICollectionGeneric;
- internal static Type TypeOfICollectionGeneric
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfICollectionGeneric == null)
- typeOfICollectionGeneric = typeof(ICollection<>);
- return typeOfICollectionGeneric;
- }
- }
- [SecurityCritical]
- static Type typeOfICollection;
- internal static Type TypeOfICollection
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfICollection == null)
- typeOfICollection = typeof(ICollection);
- return typeOfICollection;
- }
- }
- [SecurityCritical]
- static Type typeOfIEnumerableGeneric;
- internal static Type TypeOfIEnumerableGeneric
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfIEnumerableGeneric == null)
- typeOfIEnumerableGeneric = typeof(IEnumerable<>);
- return typeOfIEnumerableGeneric;
- }
- }
- [SecurityCritical]
- static Type typeOfIEnumerable;
- internal static Type TypeOfIEnumerable
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfIEnumerable == null)
- typeOfIEnumerable = typeof(IEnumerable);
- return typeOfIEnumerable;
- }
- }
- [SecurityCritical]
- static Type typeOfIEnumeratorGeneric;
- internal static Type TypeOfIEnumeratorGeneric
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfIEnumeratorGeneric == null)
- typeOfIEnumeratorGeneric = typeof(IEnumerator<>);
- return typeOfIEnumeratorGeneric;
- }
- }
- [SecurityCritical]
- static Type typeOfIEnumerator;
- internal static Type TypeOfIEnumerator
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfIEnumerator == null)
- typeOfIEnumerator = typeof(IEnumerator);
- return typeOfIEnumerator;
- }
- }
- [SecurityCritical]
- static Type typeOfKeyValuePair;
- internal static Type TypeOfKeyValuePair
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfKeyValuePair == null)
- typeOfKeyValuePair = typeof(KeyValuePair<,>);
- return typeOfKeyValuePair;
- }
- }
- [SecurityCritical]
- static Type typeOfKeyValue;
- internal static Type TypeOfKeyValue
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfKeyValue == null)
- typeOfKeyValue = typeof(KeyValue<,>);
- return typeOfKeyValue;
- }
- }
- [SecurityCritical]
- static Type typeOfIDictionaryEnumerator;
- internal static Type TypeOfIDictionaryEnumerator
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfIDictionaryEnumerator == null)
- typeOfIDictionaryEnumerator = typeof(IDictionaryEnumerator);
- return typeOfIDictionaryEnumerator;
- }
- }
- [SecurityCritical]
- static Type typeOfDictionaryEnumerator;
- internal static Type TypeOfDictionaryEnumerator
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfDictionaryEnumerator == null)
- typeOfDictionaryEnumerator = typeof(CollectionDataContract.DictionaryEnumerator);
- return typeOfDictionaryEnumerator;
- }
- }
- [SecurityCritical]
- static Type typeOfGenericDictionaryEnumerator;
- internal static Type TypeOfGenericDictionaryEnumerator
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfGenericDictionaryEnumerator == null)
- typeOfGenericDictionaryEnumerator = typeof(CollectionDataContract.GenericDictionaryEnumerator<,>);
- return typeOfGenericDictionaryEnumerator;
- }
- }
- [SecurityCritical]
- static Type typeOfDictionaryGeneric;
- internal static Type TypeOfDictionaryGeneric
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfDictionaryGeneric == null)
- typeOfDictionaryGeneric = typeof(Dictionary<,>);
- return typeOfDictionaryGeneric;
- }
- }
- [SecurityCritical]
- static Type typeOfHashtable;
- internal static Type TypeOfHashtable
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfHashtable == null)
- typeOfHashtable = typeof(Hashtable);
- return typeOfHashtable;
- }
- }
- [SecurityCritical]
- static Type typeOfListGeneric;
- internal static Type TypeOfListGeneric
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfListGeneric == null)
- typeOfListGeneric = typeof(List<>);
- return typeOfListGeneric;
- }
- }
- [SecurityCritical]
- static Type typeOfXmlElement;
- internal static Type TypeOfXmlElement
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfXmlElement == null)
- typeOfXmlElement = typeof(XmlElement);
- return typeOfXmlElement;
- }
- }
- [SecurityCritical]
- static Type typeOfDBNull;
- internal static Type TypeOfDBNull
- {
- [SecuritySafeCritical]
- get
- {
- if (typeOfDBNull == null)
- typeOfDBNull = typeof(DBNull);
- return typeOfDBNull;
- }
- }
- [SecurityCritical]
- static Uri dataContractXsdBaseNamespaceUri;
- internal static Uri DataContractXsdBaseNamespaceUri
- {
- [SecuritySafeCritical]
- get
- {
- if (dataContractXsdBaseNamespaceUri == null)
- dataContractXsdBaseNamespaceUri = new Uri(DataContractXsdBaseNamespace);
- return dataContractXsdBaseNamespaceUri;
- }
- }
- #if FEATURE_MONO_CAS
- [Fx.Tag.SecurityNote(Critical = "Holds instance of SecurityPermission that we will Demand for SerializationFormatter."
- + " Should not be modified to something else.")]
- [SecurityCritical]
- static SecurityPermission serializationFormatterPermission;
- public static SecurityPermission SerializationFormatterPermission
- {
- [Fx.Tag.SecurityNote(Critical = "Sets and accesses instance of SecurityPermission that we will Demand for SerializationFormatter.")]
- [SecurityCritical]
- get
- {
- if (serializationFormatterPermission == null)
- serializationFormatterPermission = new SecurityPermission(SecurityPermissionFlag.SerializationFormatter);
- return serializationFormatterPermission;
- }
- }
- [Fx.Tag.SecurityNote(Critical = "Holds instance of ReflectionPermission that we will Demand for MemberAccess."
- + " Should not be modified to something else.")]
- [SecurityCritical]
- static ReflectionPermission memberAccessPermission;
- public static ReflectionPermission MemberAccessPermission
- {
- [Fx.Tag.SecurityNote(Critical = "Sets and accesses instance of ReflectionPermission that we will Demand for MemberAccess.")]
- [SecurityCritical]
- get
- {
- if (memberAccessPermission == null)
- memberAccessPermission = new ReflectionPermission(ReflectionPermissionFlag.MemberAccess);
- return memberAccessPermission;
- }
- }
- #endif
- public const bool DefaultIsRequired = false;
- public const bool DefaultEmitDefaultValue = true;
- public const int DefaultOrder = 0;
- public const bool DefaultIsReference = false;
- // The value string.Empty aids comparisons (can do simple length checks
- // instead of string comparison method calls in IL.)
- public readonly static string NewObjectId = string.Empty;
- public const string SimpleSRSInternalsVisiblePattern = @"^[\s]*System\.Runtime\.Serialization[\s]*$";
- public const string FullSRSInternalsVisiblePattern = @"^[\s]*System\.Runtime\.Serialization[\s]*,[\s]*PublicKey[\s]*=[\s]*(?i:00000000000000000400000000000000)[\s]*$";
- public const string NullObjectId = null;
- public const string Space = " ";
- public const string OpenBracket = "[";
- public const string CloseBracket = "]";
- public const string Comma = ",";
- public const string XsiPrefix = "i";
- public const string XsdPrefix = "x";
- public const string SerPrefix = "z";
- public const string SerPrefixForSchema = "ser";
- public const string ElementPrefix = "q";
- public const string DataContractXsdBaseNamespace = "http://schemas.datacontract.org/2004/07/";
- public const string DataContractXmlNamespace = DataContractXsdBaseNamespace + "System.Xml";
- public const string SchemaInstanceNamespace = XmlSchema.InstanceNamespace;
- public const string SchemaNamespace = XmlSchema.Namespace;
- public const string XsiNilLocalName = "nil";
- public const string XsiTypeLocalName = "type";
- public const string TnsPrefix = "tns";
- public const string OccursUnbounded = "unbounded";
- public const string AnyTypeLocalName = "anyType";
- public const string StringLocalName = "string";
- public const string IntLocalName = "int";
- public const string True = "true";
- public const string False = "false";
- public const string ArrayPrefix = "ArrayOf";
- public const string XmlnsNamespace = "http://www.w3.org/2000/xmlns/";
- public const string XmlnsPrefix = "xmlns";
- public const string SchemaLocalName = "schema";
- public const string CollectionsNamespace = "http://schemas.microsoft.com/2003/10/Serialization/Arrays";
- public const string DefaultClrNamespace = "GeneratedNamespace";
- public const string DefaultTypeName = "GeneratedType";
- public const string DefaultGeneratedMember = "GeneratedMember";
- public const string DefaultFieldSuffix = "Field";
- public const string DefaultPropertySuffix = "Property";
- public const string DefaultMemberSuffix = "Member";
- public const string NameProperty = "Name";
- public const string NamespaceProperty = "Namespace";
- public const string OrderProperty = "Order";
- public const string IsReferenceProperty = "IsReference";
- public const string IsRequiredProperty = "IsRequired";
- public const string EmitDefaultValueProperty = "EmitDefaultValue";
- public const string ClrNamespaceProperty = "ClrNamespace";
- public const string ItemNameProperty = "ItemName";
- public const string KeyNameProperty = "KeyName";
- public const string ValueNameProperty = "ValueName";
- public const string SerializationInfoPropertyName = "SerializationInfo";
- public const string SerializationInfoFieldName = "info";
- public const string NodeArrayPropertyName = "Nodes";
- public const string NodeArrayFieldName = "nodesField";
- public const string ExportSchemaMethod = "ExportSchema";
- public const string IsAnyProperty = "IsAny";
- public const string ContextFieldName = "context";
- public const string GetObjectDataMethodName = "GetObjectData";
- public const string GetEnumeratorMethodName = "GetEnumerator";
- public const string MoveNextMethodName = "MoveNext";
- public const string AddValueMethodName = "AddValue";
- public const string CurrentPropertyName = "Current";
- public const string ValueProperty = "Value";
- public const string EnumeratorFieldName = "enumerator";
- public const string SerializationEntryFieldName = "entry";
- public const string ExtensionDataSetMethod = "set_ExtensionData";
- public const string ExtensionDataSetExplicitMethod = "System.Runtime.Serialization.IExtensibleDataObject.set_ExtensionData";
- public const string ExtensionDataObjectPropertyName = "ExtensionData";
- public const string ExtensionDataObjectFieldName = "extensionDataField";
- public const string AddMethodName = "Add";
- public const string ParseMethodName = "Parse";
- public const string GetCurrentMethodName = "get_Current";
- // NOTE: These values are used in schema below. If you modify any value, please make the same change in the schema.
- public const string SerializationNamespace = "http://schemas.microsoft.com/2003/10/Serialization/";
- public const string ClrTypeLocalName = "Type";
- public const string ClrAssemblyLocalName = "Assembly";
- public const string IsValueTypeLocalName = "IsValueType";
- public const string EnumerationValueLocalName = "EnumerationValue";
- public const string SurrogateDataLocalName = "Surrogate";
- public const string GenericTypeLocalName = "GenericType";
- public const string GenericParameterLocalName = "GenericParameter";
- public const string GenericNameAttribute = "Name";
- public const string GenericNamespaceAttribute = "Namespace";
- public const string GenericParameterNestedLevelAttribute = "NestedLevel";
- public const string IsDictionaryLocalName = "IsDictionary";
- public const string ActualTypeLocalName = "ActualType";
- public const string ActualTypeNameAttribute = "Name";
- public const string ActualTypeNamespaceAttribute = "Namespace";
- public const string DefaultValueLocalName = "DefaultValue";
- public const string EmitDefaultValueAttribute = "EmitDefaultValue";
- public const string ISerializableFactoryTypeLocalName = "FactoryType";
- public const string IdLocalName = "Id";
- public const string RefLocalName = "Ref";
- public const string ArraySizeLocalName = "Size";
- public const string KeyLocalName = "Key";
- public const string ValueLocalName = "Value";
- public const string MscorlibAssemblyName = "0";
- public const string MscorlibAssemblySimpleName = "mscorlib";
- public const string MscorlibFileName = MscorlibAssemblySimpleName + ".dll";
- public const string SerializationSchema = @"<?xml version='1.0' encoding='utf-8'?>
- <xs:schema elementFormDefault='qualified' attributeFormDefault='qualified' xmlns:tns='http://schemas.microsoft.com/2003/10/Serialization/' targetNamespace='http://schemas.microsoft.com/2003/10/Serialization/' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
- <xs:element name='anyType' nillable='true' type='xs:anyType' />
- <xs:element name='anyURI' nillable='true' type='xs:anyURI' />
- <xs:element name='base64Binary' nillable='true' type='xs:base64Binary' />
- <xs:element name='boolean' nillable='true' type='xs:boolean' />
- <xs:element name='byte' nillable='true' type='xs:byte' />
- <xs:element name='dateTime' nillable='true' type='xs:dateTime' />
- <xs:element name='decimal' nillable='true' type='xs:decimal' />
- <xs:element name='double' nillable='true' type='xs:double' />
- <xs:element name='float' nillable='true' type='xs:float' />
- <xs:element name='int' nillable='true' type='xs:int' />
- <xs:element name='long' nillable='true' type='xs:long' />
- <xs:element name='QName' nillable='true' type='xs:QName' />
- <xs:element name='short' nillable='true' type='xs:short' />
- <xs:element name='string' nillable='true' type='xs:string' />
- <xs:element name='unsignedByte' nillable='true' type='xs:unsignedByte' />
- <xs:element name='unsignedInt' nillable='true' type='xs:unsignedInt' />
- <xs:element name='unsignedLong' nillable='true' type='xs:unsignedLong' />
- <xs:element name='unsignedShort' nillable='true' type='xs:unsignedShort' />
- <xs:element name='char' nillable='true' type='tns:char' />
- <xs:simpleType name='char'>
- <xs:restriction base='xs:int'/>
- </xs:simpleType>
- <xs:element name='duration' nillable='true' type='tns:duration' />
- <xs:simpleType name='duration'>
- <xs:restriction base='xs:duration'>
- <xs:pattern value='\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?' />
- <xs:minInclusive value='-P10675199DT2H48M5.4775808S' />
- <xs:maxInclusive value='P10675199DT2H48M5.4775807S' />
- </xs:restriction>
- </xs:simpleType>
- <xs:element name='guid' nillable='true' type='tns:guid' />
- <xs:simpleType name='guid'>
- <xs:restriction base='xs:string'>
- <xs:pattern value='[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}' />
- </xs:restriction>
- </xs:simpleType>
- <xs:attribute name='FactoryType' type='xs:QName' />
- <xs:attribute name='Id' type='xs:ID' />
- <xs:attribute name='Ref' type='xs:IDREF' />
- </xs:schema>
- ";
- }
- }
|