Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ByteAnimation.cs
- FactoryGenerator.cs
- DataSourceBooleanViewSchemaConverter.cs
- PackageDigitalSignature.cs
- CommandBinding.cs
- NativeRightsManagementAPIsStructures.cs
- BamlBinaryReader.cs
- PrintingPermissionAttribute.cs
- PreviewPrintController.cs
- ZipFileInfo.cs
- TableLayoutSettings.cs
- RangeBase.cs
- FlowLayout.cs
- DESCryptoServiceProvider.cs
- XmlRawWriterWrapper.cs
- CacheHelper.cs
- rsa.cs
- FtpCachePolicyElement.cs
- odbcmetadatacolumnnames.cs
- MarshalByRefObject.cs
- TraceContext.cs
- MsmqTransportElement.cs
- WindowsSysHeader.cs
- SubtreeProcessor.cs
- ProfilePropertySettings.cs
- DocumentViewerAutomationPeer.cs
- ipaddressinformationcollection.cs
- EpmTargetPathSegment.cs
- TabControlCancelEvent.cs
- RuleRef.cs
- ExtensionQuery.cs
- XmlSchemaInferenceException.cs
- WrappedDispatcherException.cs
- ConnectionManager.cs
- BulletDecorator.cs
- SiteMapNodeItemEventArgs.cs
- GridItem.cs
- Application.cs
- SafeRegistryHandle.cs
- AssociationType.cs
- NativeWindow.cs
- BinarySecretSecurityToken.cs
- TableRowCollection.cs
- UInt64Converter.cs
- MouseActionValueSerializer.cs
- AggregateNode.cs
- ParallelTimeline.cs
- XmlDataContract.cs
- Missing.cs
- HMACMD5.cs
- InputScope.cs
- CheckBoxList.cs
- Stackframe.cs
- Win32.cs
- WarningException.cs
- Utils.cs
- XmlIncludeAttribute.cs
- ObjectDataSource.cs
- Thread.cs
- FocusTracker.cs
- InstanceKeyView.cs
- ViewGenResults.cs
- SqlVersion.cs
- TriState.cs
- SqlConnectionFactory.cs
- BindingSource.cs
- SettingsSavedEventArgs.cs
- WindowsButton.cs
- Identifier.cs
- ExpressionDumper.cs
- CollectionBuilder.cs
- VisualStyleRenderer.cs
- WindowsListView.cs
- Int16Converter.cs
- PersistChildrenAttribute.cs
- webproxy.cs
- XPathBinder.cs
- CheckBoxRenderer.cs
- Journal.cs
- HandleCollector.cs
- SQLSingleStorage.cs
- PointUtil.cs
- ReadOnlyAttribute.cs
- MessageBox.cs
- AuthenticationModeHelper.cs
- BezierSegment.cs
- NativeMethods.cs
- TransformationRules.cs
- TrustManagerPromptUI.cs
- ZoomPercentageConverter.cs
- HuffCodec.cs
- base64Transforms.cs
- StylusDownEventArgs.cs
- CorrelationManager.cs
- ContextMenuStrip.cs
- FindCriteriaApril2005.cs
- ContractMapping.cs
- ByteBufferPool.cs
- LocatorBase.cs
- StrokeRenderer.cs