Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Reflection / MethodBody.cs / 1305376 / MethodBody.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== //[....] // using System; using System.Globalization; using System.Collections.Generic; using System.Diagnostics.Contracts; namespace System.Reflection { [Flags()] [System.Runtime.InteropServices.ComVisible(true)] public enum ExceptionHandlingClauseOptions: int { Clause = 0x0, Filter = 0x1, Finally = 0x2, Fault = 0x4, } [System.Runtime.InteropServices.ComVisible(true)] public class ExceptionHandlingClause { #region costructor // This class can only be created from inside the EE. protected ExceptionHandlingClause() { } #endregion #region Private Data Members private MethodBody m_methodBody; [ContractPublicPropertyName("Flags")] private ExceptionHandlingClauseOptions m_flags; private int m_tryOffset; private int m_tryLength; private int m_handlerOffset; private int m_handlerLength; private int m_catchMetadataToken; private int m_filterOffset; #endregion #region Public Members public virtual ExceptionHandlingClauseOptions Flags { get { return m_flags; } } public virtual int TryOffset { get { return m_tryOffset; } } public virtual int TryLength { get { return m_tryLength; } } public virtual int HandlerOffset { get { return m_handlerOffset; } } public virtual int HandlerLength { get { return m_handlerLength; } } public virtual int FilterOffset { get { if (m_flags != ExceptionHandlingClauseOptions.Filter) throw new InvalidOperationException(Environment.GetResourceString("Arg_EHClauseNotFilter")); return m_filterOffset; } } public virtual Type CatchType { get { if (m_flags != ExceptionHandlingClauseOptions.Clause) throw new InvalidOperationException(Environment.GetResourceString("Arg_EHClauseNotClause")); Type type = null; if (!MetadataToken.IsNullToken(m_catchMetadataToken)) { Type declaringType = m_methodBody.m_methodBase.DeclaringType; Module module = (declaringType == null) ? m_methodBody.m_methodBase.Module : declaringType.Module; type = module.ResolveType(m_catchMetadataToken, (declaringType == null) ? null : declaringType.GetGenericArguments(), m_methodBody.m_methodBase is MethodInfo ? m_methodBody.m_methodBase.GetGenericArguments() : null); } return type; } } #endregion #region Object Overrides public override string ToString() { if (Flags == ExceptionHandlingClauseOptions.Clause) { return String.Format(CultureInfo.CurrentUICulture, "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}, CatchType={5}", Flags, TryOffset, TryLength, HandlerOffset, HandlerLength, CatchType); } if (Flags == ExceptionHandlingClauseOptions.Filter) { return String.Format(CultureInfo.CurrentUICulture, "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}, FilterOffset={5}", Flags, TryOffset, TryLength, HandlerOffset, HandlerLength, FilterOffset); } return String.Format(CultureInfo.CurrentUICulture, "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}", Flags, TryOffset, TryLength, HandlerOffset, HandlerLength); } #endregion } [System.Runtime.InteropServices.ComVisible(true)] public class MethodBody { #region costructor // This class can only be created from inside the EE. protected MethodBody() { } #endregion #region Private Data Members private byte[] m_IL; private ExceptionHandlingClause[] m_exceptionHandlingClauses; private LocalVariableInfo[] m_localVariables; internal MethodBase m_methodBase; private int m_localSignatureMetadataToken; private int m_maxStackSize; private bool m_initLocals; #endregion #region Public Members public virtual int LocalSignatureMetadataToken { get { return m_localSignatureMetadataToken; } } public virtual IListLocalVariables { get { return Array.AsReadOnly(m_localVariables); } } public virtual int MaxStackSize { get { return m_maxStackSize; } } public virtual bool InitLocals { get { return m_initLocals; } } public virtual byte[] GetILAsByteArray() { return m_IL; } public virtual IList ExceptionHandlingClauses { get { return Array.AsReadOnly(m_exceptionHandlingClauses); } } #endregion } [System.Runtime.InteropServices.ComVisible(true)] public class LocalVariableInfo { #region Private Data Members private RuntimeType m_type; private int m_isPinned; private int m_localIndex; #endregion #region Constructor protected LocalVariableInfo() { } #endregion #region Object Overrides public override string ToString() { string toString = LocalType.ToString() + " (" + LocalIndex + ")"; if (IsPinned) toString += " (pinned)"; return toString; } #endregion #region Public Members public virtual Type LocalType { get { Contract.Assert(m_type != null, "type must be set!"); return m_type; } } public virtual bool IsPinned { get { return m_isPinned != 0; } } public virtual int LocalIndex { get { return m_localIndex; } } #endregion } } // 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
- Menu.cs
- TableCellCollection.cs
- DeviceSpecificDialogCachedState.cs
- MetafileHeader.cs
- HelpEvent.cs
- StreamReader.cs
- DataServiceQuery.cs
- FactoryRecord.cs
- OdbcErrorCollection.cs
- Attributes.cs
- DiagnosticTraceSource.cs
- WindowsFormsHost.cs
- EventMap.cs
- DescendentsWalkerBase.cs
- DbConnectionHelper.cs
- wmiprovider.cs
- ChildTable.cs
- ObjectNavigationPropertyMapping.cs
- BoundColumn.cs
- FileStream.cs
- IISMapPath.cs
- _NtlmClient.cs
- InheritablePropertyChangeInfo.cs
- AsymmetricAlgorithm.cs
- CodePageEncoding.cs
- MetadataArtifactLoaderResource.cs
- StrokeRenderer.cs
- CustomSignedXml.cs
- File.cs
- RoleServiceManager.cs
- HybridDictionary.cs
- _UncName.cs
- UpdatePanelControlTrigger.cs
- RawKeyboardInputReport.cs
- BooleanKeyFrameCollection.cs
- documentation.cs
- JpegBitmapEncoder.cs
- StylusPointPropertyUnit.cs
- AttachedAnnotationChangedEventArgs.cs
- SafeRightsManagementSessionHandle.cs
- FileUpload.cs
- Monitor.cs
- NetworkCredential.cs
- x509utils.cs
- GridSplitterAutomationPeer.cs
- ZipIOExtraFieldZip64Element.cs
- PartManifestEntry.cs
- CommunicationException.cs
- Registry.cs
- WorkflowClientDeliverMessageWrapper.cs
- OutputScopeManager.cs
- EntityDataSourceWrapperCollection.cs
- ClientSettingsSection.cs
- SqlClientWrapperSmiStream.cs
- SelectionProcessor.cs
- ItemCheckedEvent.cs
- Keywords.cs
- Mappings.cs
- TextTreeRootTextBlock.cs
- glyphs.cs
- SQLInt64.cs
- ValueTable.cs
- AvTraceFormat.cs
- TemplatePagerField.cs
- LinkTarget.cs
- CodeIdentifiers.cs
- MediaScriptCommandRoutedEventArgs.cs
- HyperLinkField.cs
- SQLDateTime.cs
- BulletChrome.cs
- xml.cs
- _NativeSSPI.cs
- SettingsContext.cs
- RemoteWebConfigurationHostServer.cs
- StreamFormatter.cs
- DataContractSerializerSection.cs
- WsdlHelpGeneratorElement.cs
- CapabilitiesSection.cs
- TextEffect.cs
- SvcFileManager.cs
- ResolvedKeyFrameEntry.cs
- SqlServices.cs
- ThreadStaticAttribute.cs
- LogEntrySerializationException.cs
- WebPartConnectionsDisconnectVerb.cs
- WindowsFormsSynchronizationContext.cs
- HtmlHistory.cs
- HandledMouseEvent.cs
- StateMachineAction.cs
- Win32SafeHandles.cs
- OdbcCommand.cs
- VBIdentifierDesigner.xaml.cs
- FormatSettings.cs
- LinearGradientBrush.cs
- IntranetCredentialPolicy.cs
- WebPartManagerInternals.cs
- MessageQueueKey.cs
- PathGeometry.cs
- SystemKeyConverter.cs
- DbTransaction.cs