Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / clr / src / BCL / System / Runtime / Serialization / SerializationFieldInfo.cs / 1 / SerializationFieldInfo.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SerializationFieldInfo ** ** ** Purpose: Provides a methods of representing imaginary fields ** which are unique to serialization. In this case, what we're ** representing is the private members of parent classes. We ** aggregate the RuntimeFieldInfo associated with this member ** and return a managled form of the name. The name that we ** return is .parentname.fieldname ** ** ============================================================*/ using System; using System.Reflection; using System.Globalization; namespace System.Runtime.Serialization { internal sealed class SerializationFieldInfo : FieldInfo { internal static readonly char FakeNameSeparatorChar = '+'; internal static readonly String FakeNameSeparatorString = "+"; private RuntimeFieldInfo m_field; private String m_serializationName; public override Module Module { get { return m_field.Module; } } public override int MetadataToken { get { return m_field.MetadataToken; } } internal SerializationFieldInfo(RuntimeFieldInfo field, String namePrefix) { BCLDebug.Assert(field!=null, "[SerializationFieldInfo.ctor]field!=null"); BCLDebug.Assert(namePrefix!=null, "[SerializationFieldInfo.ctor]namePrefix!=null"); m_field = field; m_serializationName = String.Concat(namePrefix, FakeNameSeparatorString, m_field.Name); } // // MemberInfo methods // public override String Name { get { return m_serializationName; } } public override Type DeclaringType { get { return m_field.DeclaringType; } } public override Type ReflectedType { get { return m_field.ReflectedType; } } public override Object[] GetCustomAttributes(bool inherit) { return m_field.GetCustomAttributes(inherit); } public override Object[] GetCustomAttributes(Type attributeType, bool inherit) { return m_field.GetCustomAttributes(attributeType, inherit); } public override bool IsDefined(Type attributeType, bool inherit) { return m_field.IsDefined(attributeType, inherit); } // // FieldInfo methods // public override Type FieldType { get { return m_field.FieldType; } } public override Object GetValue(Object obj) { return m_field.GetValue(obj); } internal Object InternalGetValue(Object obj, bool requiresAccessCheck) { RtFieldInfo field = m_field as RtFieldInfo; if (field != null) return field.InternalGetValue(obj, requiresAccessCheck); else return m_field.GetValue(obj); } public override void SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture) { m_field.SetValue(obj, value, invokeAttr, binder, culture); } internal void InternalSetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture, bool requiresAccessCheck, bool isBinderDefault) { //m_field.InternalSetValue(obj, value, invokeAttr, binder, culture, requiresAccessCheck, isBinderDefault); RtFieldInfo field = m_field as RtFieldInfo; if (field != null) field.InternalSetValue(obj, value, invokeAttr, binder, culture, false); else m_field.SetValue(obj, value, invokeAttr, binder, culture); } internal RuntimeFieldInfo FieldInfo { get { return m_field; } } public override RuntimeFieldHandle FieldHandle { get { return m_field.FieldHandle; } } public override FieldAttributes Attributes { get { return m_field.Attributes; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SerializationFieldInfo ** ** ** Purpose: Provides a methods of representing imaginary fields ** which are unique to serialization. In this case, what we're ** representing is the private members of parent classes. We ** aggregate the RuntimeFieldInfo associated with this member ** and return a managled form of the name. The name that we ** return is .parentname.fieldname ** ** ============================================================*/ using System; using System.Reflection; using System.Globalization; namespace System.Runtime.Serialization { internal sealed class SerializationFieldInfo : FieldInfo { internal static readonly char FakeNameSeparatorChar = '+'; internal static readonly String FakeNameSeparatorString = "+"; private RuntimeFieldInfo m_field; private String m_serializationName; public override Module Module { get { return m_field.Module; } } public override int MetadataToken { get { return m_field.MetadataToken; } } internal SerializationFieldInfo(RuntimeFieldInfo field, String namePrefix) { BCLDebug.Assert(field!=null, "[SerializationFieldInfo.ctor]field!=null"); BCLDebug.Assert(namePrefix!=null, "[SerializationFieldInfo.ctor]namePrefix!=null"); m_field = field; m_serializationName = String.Concat(namePrefix, FakeNameSeparatorString, m_field.Name); } // // MemberInfo methods // public override String Name { get { return m_serializationName; } } public override Type DeclaringType { get { return m_field.DeclaringType; } } public override Type ReflectedType { get { return m_field.ReflectedType; } } public override Object[] GetCustomAttributes(bool inherit) { return m_field.GetCustomAttributes(inherit); } public override Object[] GetCustomAttributes(Type attributeType, bool inherit) { return m_field.GetCustomAttributes(attributeType, inherit); } public override bool IsDefined(Type attributeType, bool inherit) { return m_field.IsDefined(attributeType, inherit); } // // FieldInfo methods // public override Type FieldType { get { return m_field.FieldType; } } public override Object GetValue(Object obj) { return m_field.GetValue(obj); } internal Object InternalGetValue(Object obj, bool requiresAccessCheck) { RtFieldInfo field = m_field as RtFieldInfo; if (field != null) return field.InternalGetValue(obj, requiresAccessCheck); else return m_field.GetValue(obj); } public override void SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture) { m_field.SetValue(obj, value, invokeAttr, binder, culture); } internal void InternalSetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture, bool requiresAccessCheck, bool isBinderDefault) { //m_field.InternalSetValue(obj, value, invokeAttr, binder, culture, requiresAccessCheck, isBinderDefault); RtFieldInfo field = m_field as RtFieldInfo; if (field != null) field.InternalSetValue(obj, value, invokeAttr, binder, culture, false); else m_field.SetValue(obj, value, invokeAttr, binder, culture); } internal RuntimeFieldInfo FieldInfo { get { return m_field; } } public override RuntimeFieldHandle FieldHandle { get { return m_field.FieldHandle; } } public override FieldAttributes Attributes { get { return m_field.Attributes; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AnimationLayer.cs
- IListConverters.cs
- BinaryObjectInfo.cs
- JavaScriptObjectDeserializer.cs
- MasterPageCodeDomTreeGenerator.cs
- FileDialog.cs
- ExceptionUtility.cs
- IUnknownConstantAttribute.cs
- XNodeSchemaApplier.cs
- AssemblyName.cs
- DataGridViewTopRowAccessibleObject.cs
- autovalidator.cs
- TypeConverterMarkupExtension.cs
- XPathDocumentNavigator.cs
- SHA256Managed.cs
- CharUnicodeInfo.cs
- TextProviderWrapper.cs
- ItemCheckedEvent.cs
- MediaContextNotificationWindow.cs
- XmlSiteMapProvider.cs
- FileFormatException.cs
- BulletChrome.cs
- OracleRowUpdatedEventArgs.cs
- QilParameter.cs
- ReflectionUtil.cs
- Pkcs7Recipient.cs
- _Semaphore.cs
- XPathNodeIterator.cs
- AccessDataSourceView.cs
- ManifestResourceInfo.cs
- ContentTextAutomationPeer.cs
- DbException.cs
- SQLMembershipProvider.cs
- SkewTransform.cs
- StaticSiteMapProvider.cs
- SaveRecipientRequest.cs
- Grid.cs
- BaseTypeViewSchema.cs
- SoapIncludeAttribute.cs
- XmlNodeReader.cs
- SessionParameter.cs
- FormsAuthenticationCredentials.cs
- PathSegmentCollection.cs
- OneToOneMappingSerializer.cs
- RegexFCD.cs
- SchemaElementDecl.cs
- XmlSchemaObjectTable.cs
- PageStatePersister.cs
- CommunicationObjectManager.cs
- WebHttpSecurityElement.cs
- SaveFileDialog.cs
- TreeBuilderXamlTranslator.cs
- ObjectMemberMapping.cs
- OdbcException.cs
- ResXResourceWriter.cs
- SaveFileDialog.cs
- HasCopySemanticsAttribute.cs
- WsdlBuildProvider.cs
- MemberInitExpression.cs
- InfoCardKeyedHashAlgorithm.cs
- CollectionBase.cs
- PrivilegedConfigurationManager.cs
- DeferrableContentConverter.cs
- ListViewInsertedEventArgs.cs
- ApplicationServiceHelper.cs
- Timeline.cs
- ControlPropertyNameConverter.cs
- DataList.cs
- HttpApplicationFactory.cs
- SymLanguageType.cs
- Win32Native.cs
- DataControlFieldHeaderCell.cs
- Matrix.cs
- HyperLinkField.cs
- OutputWindow.cs
- ScaleTransform.cs
- ServiceOperationHelpers.cs
- DefaultHttpHandler.cs
- XmlSchemaInferenceException.cs
- TreeNodeBinding.cs
- PersonalizationStateInfo.cs
- DesignSurfaceEvent.cs
- DataGridViewControlCollection.cs
- Matrix3D.cs
- TextModifierScope.cs
- HtmlInputReset.cs
- MergeFailedEvent.cs
- SamlAttributeStatement.cs
- MetadataCache.cs
- MonikerUtility.cs
- Size.cs
- XmlSerializableServices.cs
- DependencyObjectType.cs
- AliasedSlot.cs
- ScopedKnownTypes.cs
- WebPartCollection.cs
- ObfuscationAttribute.cs
- sqlinternaltransaction.cs
- DataSourceControlBuilder.cs
- WebUtil.cs