Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / Microsoft / Scripting / Compiler / DelegateHelpers.cs / 1305376 / DelegateHelpers.cs
/* **************************************************************************** * * Copyright (c) Microsoft Corporation. * * This source code is subject to terms and conditions of the Microsoft Public License. A * copy of the license can be found in the License.html file at the root of this distribution. If * you cannot locate the Microsoft Public License, please send an email to * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound * by the terms of the Microsoft Public License. * * You must not remove this notice, or any other, from this software. * * * ***************************************************************************/ using System.Dynamic.Utils; using System.Reflection; using System.Reflection.Emit; namespace System.Linq.Expressions.Compiler { internal static partial class DelegateHelpers { private const MethodAttributes CtorAttributes = MethodAttributes.RTSpecialName | MethodAttributes.HideBySig | MethodAttributes.Public; private const MethodImplAttributes ImplAttributes = MethodImplAttributes.Runtime | MethodImplAttributes.Managed; private const MethodAttributes InvokeAttributes = MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.NewSlot | MethodAttributes.Virtual; private static readonly Type[] _DelegateCtorSignature = new Type[] { typeof(object), typeof(IntPtr) }; private static Type MakeNewCustomDelegate(Type[] types) { Type returnType = types[types.Length - 1]; Type[] parameters = types.RemoveLast(); TypeBuilder builder = AssemblyGen.DefineDelegateType("Delegate" + types.Length); builder.DefineConstructor(CtorAttributes, CallingConventions.Standard, _DelegateCtorSignature).SetImplementationFlags(ImplAttributes); builder.DefineMethod("Invoke", InvokeAttributes, returnType, parameters).SetImplementationFlags(ImplAttributes); return builder.CreateType(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. /* **************************************************************************** * * Copyright (c) Microsoft Corporation. * * This source code is subject to terms and conditions of the Microsoft Public License. A * copy of the license can be found in the License.html file at the root of this distribution. If * you cannot locate the Microsoft Public License, please send an email to * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound * by the terms of the Microsoft Public License. * * You must not remove this notice, or any other, from this software. * * * ***************************************************************************/ using System.Dynamic.Utils; using System.Reflection; using System.Reflection.Emit; namespace System.Linq.Expressions.Compiler { internal static partial class DelegateHelpers { private const MethodAttributes CtorAttributes = MethodAttributes.RTSpecialName | MethodAttributes.HideBySig | MethodAttributes.Public; private const MethodImplAttributes ImplAttributes = MethodImplAttributes.Runtime | MethodImplAttributes.Managed; private const MethodAttributes InvokeAttributes = MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.NewSlot | MethodAttributes.Virtual; private static readonly Type[] _DelegateCtorSignature = new Type[] { typeof(object), typeof(IntPtr) }; private static Type MakeNewCustomDelegate(Type[] types) { Type returnType = types[types.Length - 1]; Type[] parameters = types.RemoveLast(); TypeBuilder builder = AssemblyGen.DefineDelegateType("Delegate" + types.Length); builder.DefineConstructor(CtorAttributes, CallingConventions.Standard, _DelegateCtorSignature).SetImplementationFlags(ImplAttributes); builder.DefineMethod("Invoke", InvokeAttributes, returnType, parameters).SetImplementationFlags(ImplAttributes); return builder.CreateType(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WrapPanel.cs
- DefaultHttpHandler.cs
- IdentityHolder.cs
- ParenExpr.cs
- WorkflowInvoker.cs
- SwitchElementsCollection.cs
- BufferedGraphicsContext.cs
- TextEditorCharacters.cs
- HandleTable.cs
- SinglePageViewer.cs
- Compress.cs
- Constants.cs
- XmlArrayItemAttribute.cs
- ContentHostHelper.cs
- LocalizationParserHooks.cs
- XmlBindingWorker.cs
- EventDescriptorCollection.cs
- BindingWorker.cs
- ColorAnimation.cs
- DbConvert.cs
- ClonableStack.cs
- AspProxy.cs
- HelpKeywordAttribute.cs
- ping.cs
- ListViewGroup.cs
- Accessors.cs
- PropertyOverridesDialog.cs
- OracleDataAdapter.cs
- Misc.cs
- FormViewDeletedEventArgs.cs
- ClientSettingsProvider.cs
- _Semaphore.cs
- FilterEventArgs.cs
- XmlSchemaSimpleType.cs
- CodeCompiler.cs
- Library.cs
- TypeGeneratedEventArgs.cs
- panel.cs
- DataGridViewControlCollection.cs
- WebPartVerbsEventArgs.cs
- StylusPoint.cs
- DataGridRow.cs
- Emitter.cs
- GenericEnumerator.cs
- TdsEnums.cs
- IResourceProvider.cs
- CfgParser.cs
- ConfigXmlWhitespace.cs
- CancellationScope.cs
- StylusPoint.cs
- Activator.cs
- StreamWriter.cs
- ThicknessKeyFrameCollection.cs
- TemplateBindingExtensionConverter.cs
- SafeRightsManagementEnvironmentHandle.cs
- LongValidator.cs
- MarkedHighlightComponent.cs
- DictionaryKeyPropertyAttribute.cs
- Int64AnimationUsingKeyFrames.cs
- FrameworkContentElement.cs
- Transform3DCollection.cs
- DeviceSpecificChoice.cs
- EntityContainerEntitySet.cs
- RoleManagerSection.cs
- ActivatedMessageQueue.cs
- SamlAuthenticationClaimResource.cs
- DocumentAutomationPeer.cs
- RawStylusActions.cs
- ProviderConnectionPoint.cs
- HttpApplicationFactory.cs
- ExecutionEngineException.cs
- DrawingState.cs
- DockPattern.cs
- FilteredAttributeCollection.cs
- CmsInterop.cs
- CodeGenerator.cs
- UrlAuthFailedErrorFormatter.cs
- WebPartAddingEventArgs.cs
- XPathCompiler.cs
- CacheOutputQuery.cs
- OpenFileDialog.cs
- ChangeProcessor.cs
- Permission.cs
- ToolStripSystemRenderer.cs
- EpmHelper.cs
- Enumerable.cs
- Exceptions.cs
- _SslSessionsCache.cs
- CounterSet.cs
- HyperLink.cs
- PeerApplication.cs
- SiteMapNode.cs
- WebServiceData.cs
- XmlSiteMapProvider.cs
- NameScope.cs
- AsymmetricAlgorithm.cs
- ObjectStateManager.cs
- xsdvalidator.cs
- FontStretches.cs
- Exceptions.cs