Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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; } } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SamlAssertionKeyIdentifierClause.cs
- UrlMappingsModule.cs
- XamlRtfConverter.cs
- DataQuery.cs
- LocalClientSecuritySettingsElement.cs
- UnsafeNativeMethods.cs
- EntitySqlQueryBuilder.cs
- RuntimeIdentifierPropertyAttribute.cs
- AttributedMetaModel.cs
- CalloutQueueItem.cs
- XmlUtf8RawTextWriter.cs
- ServiceDescriptionReflector.cs
- BroadcastEventHelper.cs
- CodeNamespaceImport.cs
- METAHEADER.cs
- DeploymentExceptionMapper.cs
- ConfigDefinitionUpdates.cs
- MetadataItemEmitter.cs
- TypeForwardedFromAttribute.cs
- SqlDataSourceCustomCommandPanel.cs
- QueryReaderSettings.cs
- WhiteSpaceTrimStringConverter.cs
- SecurityTraceRecordHelper.cs
- AttachedPropertyBrowsableAttribute.cs
- AffineTransform3D.cs
- ScrollProperties.cs
- XamlReader.cs
- PackagePart.cs
- Contracts.cs
- BinaryNode.cs
- LogExtent.cs
- Identifier.cs
- WinFormsSecurity.cs
- SecurityDescriptor.cs
- MergeLocalizationDirectives.cs
- GlobalProxySelection.cs
- HttpListenerResponse.cs
- PLINQETWProvider.cs
- MailWebEventProvider.cs
- SQLResource.cs
- UriTemplateEquivalenceComparer.cs
- ReferenceSchema.cs
- CommandArguments.cs
- UIElementAutomationPeer.cs
- UInt32Converter.cs
- ImageDesigner.cs
- InputReportEventArgs.cs
- InfoCardClaim.cs
- wgx_sdk_version.cs
- IdentifierCollection.cs
- RelatedPropertyManager.cs
- DataGridHeaderBorder.cs
- SecurityTokenValidationException.cs
- PasswordValidationException.cs
- BamlRecordHelper.cs
- PageParser.cs
- SplitterPanel.cs
- CommonDialog.cs
- GestureRecognitionResult.cs
- Utility.cs
- SystemKeyConverter.cs
- EntityTransaction.cs
- FormattedText.cs
- EventListener.cs
- XmlDocument.cs
- GeneralTransform3DTo2DTo3D.cs
- XmlTextReaderImplHelpers.cs
- _Win32.cs
- WebPartPersonalization.cs
- OracleRowUpdatingEventArgs.cs
- RuntimeResourceSet.cs
- FontFamilyValueSerializer.cs
- ConfigurationSection.cs
- Cursors.cs
- TaskFormBase.cs
- ControlUtil.cs
- ValueUnavailableException.cs
- FacetChecker.cs
- LocationInfo.cs
- AddInEnvironment.cs
- ProfileGroupSettingsCollection.cs
- ScrollBar.cs
- BasicViewGenerator.cs
- TextOutput.cs
- OleDbFactory.cs
- MessageFilterTable.cs
- OdbcTransaction.cs
- DataGridViewAutoSizeModeEventArgs.cs
- dataSvcMapFileLoader.cs
- XmlQualifiedName.cs
- RangeContentEnumerator.cs
- LeftCellWrapper.cs
- XmlSecureResolver.cs
- SqlDuplicator.cs
- BitmapEffectInputConnector.cs
- Stack.cs
- HelpEvent.cs
- PassportIdentity.cs
- TabItem.cs
- DataRecordInfo.cs