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
- ProviderCollection.cs
- dataobject.cs
- _NegoStream.cs
- NumberFunctions.cs
- DockProviderWrapper.cs
- Point3DCollection.cs
- JavaScriptObjectDeserializer.cs
- WpfKnownMemberInvoker.cs
- InfoCardUIAgent.cs
- Application.cs
- XmlReaderDelegator.cs
- ControlUtil.cs
- BinaryQueryOperator.cs
- SubstitutionList.cs
- CodeDOMUtility.cs
- ExclusiveTcpListener.cs
- ParallelTimeline.cs
- TypeExtensionConverter.cs
- SiteOfOriginContainer.cs
- HtmlTernaryTree.cs
- MemberDescriptor.cs
- SecurityUtils.cs
- DeviceSpecificChoice.cs
- _TimerThread.cs
- DifferencingCollection.cs
- BooleanAnimationBase.cs
- DescendantOverDescendantQuery.cs
- EntityContainerEntitySet.cs
- WebSysDefaultValueAttribute.cs
- DataExchangeServiceBinder.cs
- GenericAuthenticationEventArgs.cs
- NullableFloatAverageAggregationOperator.cs
- MimeParameter.cs
- FunctionDetailsReader.cs
- DataRowComparer.cs
- WindowShowOrOpenTracker.cs
- COM2EnumConverter.cs
- PreloadHost.cs
- FixedSOMPage.cs
- SQLResource.cs
- TextRangeEditLists.cs
- KeyTimeConverter.cs
- ConfigXmlComment.cs
- CngKeyCreationParameters.cs
- CompiledXpathExpr.cs
- BaseHashHelper.cs
- WebBrowserNavigatingEventHandler.cs
- SpotLight.cs
- AcceptorSessionSymmetricMessageSecurityProtocol.cs
- XPathMultyIterator.cs
- FeatureSupport.cs
- HttpModuleCollection.cs
- Timer.cs
- InstanceOwner.cs
- ParameterModifier.cs
- WindowsBrush.cs
- safemediahandle.cs
- GACIdentityPermission.cs
- DataGridViewToolTip.cs
- OptimalBreakSession.cs
- WindowsFormsLinkLabel.cs
- CommandConverter.cs
- BamlBinaryReader.cs
- SqlDependency.cs
- ListDictionaryInternal.cs
- AppSettingsExpressionBuilder.cs
- EndpointAddress.cs
- QilInvokeEarlyBound.cs
- SqlBuilder.cs
- HitTestWithGeometryDrawingContextWalker.cs
- AncestorChangedEventArgs.cs
- FaultReason.cs
- XslCompiledTransform.cs
- ClientConfigurationHost.cs
- Transform.cs
- ByteAnimation.cs
- HostingPreferredMapPath.cs
- __Error.cs
- IResourceProvider.cs
- ReferencedAssembly.cs
- SystemResources.cs
- Button.cs
- SemaphoreFullException.cs
- ItemsChangedEventArgs.cs
- EntityDataSourceDesignerHelper.cs
- UriScheme.cs
- HandledEventArgs.cs
- LambdaCompiler.Generated.cs
- NamedObject.cs
- ObjectMemberMapping.cs
- Dynamic.cs
- ProgressBarBrushConverter.cs
- VisualBasic.cs
- IsolationInterop.cs
- MouseButton.cs
- TreeNodeEventArgs.cs
- GridViewCommandEventArgs.cs
- EffectiveValueEntry.cs
- PropertyChangedEventArgs.cs
- EmbeddedMailObjectsCollection.cs