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
- addressfiltermode.cs
- MiniConstructorInfo.cs
- TypeBinaryExpression.cs
- NominalTypeEliminator.cs
- UIElement3DAutomationPeer.cs
- HotCommands.cs
- MsmqPoisonMessageException.cs
- TextDecorations.cs
- TimerEventSubscriptionCollection.cs
- SingleAnimationBase.cs
- XmlCodeExporter.cs
- SpotLight.cs
- AncillaryOps.cs
- CollectionChange.cs
- Rotation3D.cs
- DesignerActionItem.cs
- XmlExtensionFunction.cs
- TransactionContextManager.cs
- InternalSafeNativeMethods.cs
- KeyboardInputProviderAcquireFocusEventArgs.cs
- ContainerVisual.cs
- HtmlButton.cs
- XmlSchemaInclude.cs
- FilteredDataSetHelper.cs
- LineGeometry.cs
- TextSpan.cs
- LinqDataSourceDeleteEventArgs.cs
- ProgressPage.cs
- CultureInfoConverter.cs
- Operator.cs
- IsolatedStorageFile.cs
- VisualTreeFlattener.cs
- RemoteWebConfigurationHostServer.cs
- TextDpi.cs
- AttributeCollection.cs
- TextFormatterHost.cs
- PngBitmapEncoder.cs
- FixedStringLookup.cs
- ApplicationProxyInternal.cs
- SqlClientWrapperSmiStreamChars.cs
- NetworkInformationPermission.cs
- DateTimeEditor.cs
- HttpException.cs
- EntityType.cs
- OdbcFactory.cs
- DependencyObjectType.cs
- formatter.cs
- x509utils.cs
- CompModSwitches.cs
- ClonableStack.cs
- ModulesEntry.cs
- AmbientProperties.cs
- XPathDocument.cs
- DataColumnCollection.cs
- SQLBoolean.cs
- OleDbConnectionInternal.cs
- Query.cs
- iisPickupDirectory.cs
- FixedTextBuilder.cs
- Vertex.cs
- RootBuilder.cs
- DllNotFoundException.cs
- PerspectiveCamera.cs
- TextTreeUndoUnit.cs
- ConvertEvent.cs
- IconHelper.cs
- LinkButton.cs
- EventLog.cs
- SqlNotificationRequest.cs
- SoapInteropTypes.cs
- RequestedSignatureDialog.cs
- DataSourceControlBuilder.cs
- DependencyPropertyConverter.cs
- WindowsFormsHelpers.cs
- ObjectDisposedException.cs
- ForeignConstraint.cs
- Activator.cs
- DependencyProperty.cs
- BindingContext.cs
- DataRowComparer.cs
- HandleCollector.cs
- RightsManagementInformation.cs
- SspiSafeHandles.cs
- control.ime.cs
- DetailsViewRowCollection.cs
- StorageFunctionMapping.cs
- StringInfo.cs
- HostProtectionException.cs
- Range.cs
- PenLineJoinValidation.cs
- AssemblyCollection.cs
- SponsorHelper.cs
- SqlXml.cs
- Vector3DValueSerializer.cs
- WaitHandle.cs
- SqlClientWrapperSmiStream.cs
- UrlEncodedParameterWriter.cs
- RemoteWebConfigurationHost.cs
- PropertyNames.cs
- XamlStyleSerializer.cs