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
- PermissionSetTriple.cs
- OleDbStruct.cs
- TableCellCollection.cs
- Util.cs
- _HeaderInfoTable.cs
- AsymmetricKeyExchangeFormatter.cs
- MediaCommands.cs
- RecipientInfo.cs
- SecurityDescriptor.cs
- DataBindingList.cs
- SQLBytesStorage.cs
- DataSourceCacheDurationConverter.cs
- ListItemCollection.cs
- ExceptionNotification.cs
- ReferencedAssembly.cs
- OpCopier.cs
- TripleDESCryptoServiceProvider.cs
- CheckPair.cs
- ComponentChangedEvent.cs
- NullableDecimalSumAggregationOperator.cs
- OracleTimeSpan.cs
- KeyedHashAlgorithm.cs
- XmlSchemaGroupRef.cs
- FunctionDetailsReader.cs
- SmiRecordBuffer.cs
- Quaternion.cs
- __Filters.cs
- BrowserCapabilitiesFactory.cs
- FixedDocumentPaginator.cs
- Errors.cs
- LicenseContext.cs
- XmlHelper.cs
- ModuleBuilder.cs
- CellTreeNode.cs
- BrowserCapabilitiesFactoryBase.cs
- TraceData.cs
- CorrelationManager.cs
- NeutralResourcesLanguageAttribute.cs
- SpecialTypeDataContract.cs
- CommandField.cs
- MatchingStyle.cs
- dtdvalidator.cs
- PresentationAppDomainManager.cs
- Terminate.cs
- CallTemplateAction.cs
- Sequence.cs
- AlternationConverter.cs
- BeginEvent.cs
- CommonBehaviorsSection.cs
- Attachment.cs
- Pen.cs
- SubclassTypeValidatorAttribute.cs
- ExtendLockCommand.cs
- GZipDecoder.cs
- AsnEncodedData.cs
- BulletedListEventArgs.cs
- DataGridTableCollection.cs
- HierarchicalDataSourceControl.cs
- ShaderRenderModeValidation.cs
- PointF.cs
- TextDocumentView.cs
- ParameterElement.cs
- CompressEmulationStream.cs
- MsmqAppDomainProtocolHandler.cs
- CheckBoxList.cs
- GroupQuery.cs
- AppDomainManager.cs
- LabelAutomationPeer.cs
- safesecurityhelperavalon.cs
- ReservationNotFoundException.cs
- WindowsFormsHost.cs
- ToolTipService.cs
- MetadataCacheItem.cs
- _NetRes.cs
- XamlClipboardData.cs
- SafeNativeMethods.cs
- DesignerAttribute.cs
- BoundField.cs
- StylusTip.cs
- ModelToObjectValueConverter.cs
- iisPickupDirectory.cs
- SqlConnectionPoolGroupProviderInfo.cs
- FastEncoderWindow.cs
- Stack.cs
- AnonymousIdentificationSection.cs
- Table.cs
- ChannelReliableSession.cs
- Simplifier.cs
- SspiHelper.cs
- DbReferenceCollection.cs
- Canvas.cs
- NameSpaceExtractor.cs
- DataGrid.cs
- SymbolPair.cs
- HwndSource.cs
- DataGridViewAccessibleObject.cs
- EncodingNLS.cs
- FormViewUpdatedEventArgs.cs
- Helpers.cs
- IconConverter.cs