Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / clr / src / BCL / System / Reflection / Emit / LocalBuilder.cs / 1 / LocalBuilder.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== using System; using System.Reflection; using System.Security.Permissions; using System.Runtime.InteropServices; namespace System.Reflection.Emit { [ClassInterface(ClassInterfaceType.None)] [ComDefaultInterface(typeof(_LocalBuilder))] [System.Runtime.InteropServices.ComVisible(true)] public sealed class LocalBuilder : LocalVariableInfo, _LocalBuilder { #region Private Data Members private int m_localIndex; private Type m_localType; private MethodInfo m_methodBuilder; private bool m_isPinned; #endregion #region Constructor private LocalBuilder() { } internal LocalBuilder(int localIndex, Type localType, MethodInfo methodBuilder) : this(localIndex, localType, methodBuilder, false) { } internal LocalBuilder(int localIndex, Type localType, MethodInfo methodBuilder, bool isPinned) { m_isPinned = isPinned; m_localIndex = localIndex; m_localType = localType; m_methodBuilder = methodBuilder; } #endregion #region Internal Members internal int GetLocalIndex() { return m_localIndex; } internal MethodInfo GetMethodBuilder() { return m_methodBuilder; } #endregion #region LocalVariableInfo Override public override bool IsPinned { get { return m_isPinned; } } public override Type LocalType { get { return m_localType; } } public override int LocalIndex { get { return m_localIndex; } } #endregion #region Public Members public void SetLocalSymInfo(String name) { SetLocalSymInfo(name, 0, 0); } public void SetLocalSymInfo(String name, int startOffset, int endOffset) { ModuleBuilder dynMod; SignatureHelper sigHelp; int sigLength; byte[] signature; byte[] mungedSig; int index; MethodBuilder methodBuilder = m_methodBuilder as MethodBuilder; if (methodBuilder == null) // it's a light code gen entity throw new NotSupportedException(); dynMod = (ModuleBuilder) methodBuilder.Module; if (methodBuilder.IsTypeCreated()) { // cannot change method after its containing type has been created throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_TypeHasBeenCreated")); } // set the name and range of offset for the local if (dynMod.GetSymWriter() == null) { // cannot set local name if not debug module throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotADebugModule")); } sigHelp = SignatureHelper.GetFieldSigHelper(dynMod); sigHelp.AddArgument(m_localType); signature = sigHelp.InternalGetSignature(out sigLength); // The symbol store doesn't want the calling convention on the // front of the signature, but InternalGetSignature returns // the callinging convention. So we strip it off. This is a // bit unfortunate, since it means that we need to allocate // yet another array of bytes... mungedSig = new byte[sigLength - 1]; Array.Copy(signature, 1, mungedSig, 0, sigLength - 1); index = methodBuilder.GetILGenerator().m_ScopeTree.GetCurrentActiveScopeIndex(); if (index == -1) { // top level scope information is kept with methodBuilder methodBuilder.m_localSymInfo.AddLocalSymInfo( name, mungedSig, m_localIndex, startOffset, endOffset); } else { methodBuilder.GetILGenerator().m_ScopeTree.AddLocalSymInfoToCurrentScope( name, mungedSig, m_localIndex, startOffset, endOffset); } } #endregion void _LocalBuilder.GetTypeInfoCount(out uint pcTInfo) { throw new NotImplementedException(); } void _LocalBuilder.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo) { throw new NotImplementedException(); } void _LocalBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId) { throw new NotImplementedException(); } void _LocalBuilder.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr) { throw new NotImplementedException(); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XmlEncodedRawTextWriter.cs
- DeobfuscatingStream.cs
- FramingEncoders.cs
- MachineKey.cs
- TextServicesCompartmentContext.cs
- GridViewRow.cs
- ListChangedEventArgs.cs
- SqlClientPermission.cs
- SaveLedgerEntryRequest.cs
- TempFiles.cs
- AnnouncementDispatcherAsyncResult.cs
- HwndSubclass.cs
- DataGridItem.cs
- SmtpMail.cs
- TextBoxAutoCompleteSourceConverter.cs
- DocumentReference.cs
- Label.cs
- SafeNativeMethods.cs
- SiteMapHierarchicalDataSourceView.cs
- HttpResponseInternalWrapper.cs
- FreezableCollection.cs
- OLEDB_Enum.cs
- SafeNativeMethods.cs
- ToolboxItem.cs
- Terminate.cs
- CompositeCollectionView.cs
- DbQueryCommandTree.cs
- ZipFileInfo.cs
- ImageSourceConverter.cs
- EntityExpressionVisitor.cs
- DataGridViewLayoutData.cs
- followingsibling.cs
- HttpListenerResponse.cs
- WebPartConnectionsConfigureVerb.cs
- IteratorFilter.cs
- AdvancedBindingPropertyDescriptor.cs
- ISO2022Encoding.cs
- ObjectListCommandEventArgs.cs
- InputProcessorProfiles.cs
- ResXResourceWriter.cs
- RegisteredArrayDeclaration.cs
- DSASignatureDeformatter.cs
- ErrorTableItemStyle.cs
- DecimalStorage.cs
- NumericUpDownAcceleration.cs
- SegmentInfo.cs
- ValueHandle.cs
- SimpleHandlerFactory.cs
- CapabilitiesUse.cs
- AsyncCodeActivityContext.cs
- ReadOnlyPropertyMetadata.cs
- EdmProviderManifest.cs
- CursorConverter.cs
- SmiTypedGetterSetter.cs
- FlowDocumentReader.cs
- UIntPtr.cs
- QuaternionRotation3D.cs
- TypeUnloadedException.cs
- EntityViewGenerationConstants.cs
- DotExpr.cs
- WebPart.cs
- FileSystemInfo.cs
- EditingMode.cs
- Geometry3D.cs
- XmlSchemaObjectCollection.cs
- CacheMode.cs
- Inflater.cs
- HostDesigntimeLicenseContext.cs
- PeerTransportListenAddressConverter.cs
- RichTextBox.cs
- _DomainName.cs
- relpropertyhelper.cs
- DataFieldCollectionEditor.cs
- EdmSchemaError.cs
- ArglessEventHandlerProxy.cs
- ValueTypeIndexerReference.cs
- StrongNamePublicKeyBlob.cs
- DispatcherProcessingDisabled.cs
- OdbcUtils.cs
- ManagementOperationWatcher.cs
- ContextQuery.cs
- Rule.cs
- TextServicesDisplayAttributePropertyRanges.cs
- ISAPIRuntime.cs
- FormsAuthenticationModule.cs
- XmlToDatasetMap.cs
- Converter.cs
- CoTaskMemHandle.cs
- OleDbRowUpdatedEvent.cs
- Facet.cs
- NotFiniteNumberException.cs
- WebSysDefaultValueAttribute.cs
- DocumentSequence.cs
- MsmqPoisonMessageException.cs
- TreeSet.cs
- NameNode.cs
- WCFModelStrings.Designer.cs
- NumberSubstitution.cs
- XmlWhitespace.cs
- WebEventTraceProvider.cs