2 types derived from Delegate
System.Private.CoreLib (2)
728 references to Delegate
dotnet-svcutil-lib (2)
illink (2)
ILLink.RoslynAnalyzer (2)
Microsoft.AspNetCore.Components (9)
Microsoft.AspNetCore.Components.Endpoints (5)
Microsoft.AspNetCore.Components.Tests (1)
Microsoft.AspNetCore.Grpc.JsonTranscoding (3)
Microsoft.AspNetCore.Grpc.JsonTranscoding.IntegrationTests (3)
Microsoft.AspNetCore.Hosting (1)
Microsoft.AspNetCore.Http.Abstractions (5)
Microsoft.AspNetCore.Http.Extensions (16)
RequestDelegateFactory.cs (12)
35/// Creates <see cref="RequestDelegate"/> implementations from <see cref="Delegate"/> request handlers.
135/// Returns metadata inferred automatically for the <see cref="RequestDelegate"/> created by <see cref="Create(Delegate, RequestDelegateFactoryOptions?, RequestDelegateMetadataResult?)"/>.
138/// <param name="methodInfo">The <see cref="MethodInfo"/> for the route handler to be passed to <see cref="Create(Delegate, RequestDelegateFactoryOptions?, RequestDelegateMetadataResult?)"/>.</param>
139/// <param name="options">The options that will be used when calling <see cref="Create(Delegate, RequestDelegateFactoryOptions?, RequestDelegateMetadataResult?)"/>.</param>
140/// <returns>The <see cref="RequestDelegateMetadataResult"/> to be passed to <see cref="Create(Delegate, RequestDelegateFactoryOptions?, RequestDelegateMetadataResult?)"/>.</returns>
159public static RequestDelegateResult Create(Delegate handler, RequestDelegateFactoryOptions? options)
171/// If <see langword="null"/>, this call to <see cref="Create(Delegate, RequestDelegateFactoryOptions?, RequestDelegateMetadataResult?)"/> method will infer the metadata that
172/// <see cref="InferMetadata(MethodInfo, RequestDelegateFactoryOptions?)"/> would have inferred for the same <see cref="Delegate.Method"/> and populate <see cref="RequestDelegateFactoryOptions.EndpointBuilder"/>
177public static RequestDelegateResult Create(Delegate handler, RequestDelegateFactoryOptions? options = null, RequestDelegateMetadataResult? metadataResult = null)
223/// If <see langword="null"/>, this call to <see cref="Create(Delegate, RequestDelegateFactoryOptions?, RequestDelegateMetadataResult?)"/> method will infer the metadata that
224/// <see cref="InferMetadata(MethodInfo, RequestDelegateFactoryOptions?)"/> would have inferred for the same <see cref="Delegate.Method"/> and populate <see cref="RequestDelegateFactoryOptions.EndpointBuilder"/>
266private static RequestDelegateFactoryContext CreateFactoryContext(RequestDelegateFactoryOptions? options, RequestDelegateMetadataResult? metadataResult = null, Delegate? handler = null)
Microsoft.AspNetCore.Http.Extensions.Tests (21)
RequestDelegateFactoryTests.cs (21)
102public async Task RequestDelegateInvokesAction(Delegate @delegate)
579public async Task RequestDelegateHandlesDoesNotHandleArraysFromQueryStringWhenBodyIsInferred(Delegate action, string[]? queryValues, object? expectedParameterValue)
727public void CreateThrowsInvalidOperationExceptionWhenAttributeRequiresTryParseMethodThatDoesNotExist(Delegate action)
841public async Task RequestDelegatePopulatesFromBodyParameter(Delegate action)
884public async Task RequestDelegateRejectsEmptyBodyGivenExplicitFromBodyParameter(Delegate action)
1018Delegate @delegate,
1135public async Task RequestDelegateRequiresServiceForAllImplicitFromServiceParameters(Delegate action)
1151public async Task RequestDelegateWithExplicitFromServiceParameters(Delegate action)
1168public async Task RequestDelegatePopulatesParametersFromServiceWithAndWithoutAttribute(Delegate action)
1339public async Task RequestDelegateWritesMembersFromChildTypesToJsonResponseBody_WithJsonPolymorphicOptions(Delegate @delegate)
1371public async Task RequestDelegateWritesJsonTypeDiscriminatorToJsonResponseBody_WithJsonPolymorphicOptions(Delegate @delegate)
1472public async Task RequestDelegateUsesCustomIResult(Delegate @delegate)
1511public async Task RequestDelegateThrowsInvalidOperationExceptionOnNullDelegate(Delegate @delegate, string message)
1556public async Task RequestDelegateHandlesRouteParamOptionality(Delegate @delegate, string paramName, string? routeParam, bool isInvalid, string? expectedResponse)
1661public async Task RequestDelegateHandlesBindAsyncOptionality(Delegate routeHandler, bool includeReferer, bool isInvalid, bool isStruct)
1732public async Task RequestDelegateHandlesServiceParamOptionality(Delegate @delegate, bool hasService, bool isInvalid)
1899public async Task RequestDelegateCanProcessUriValues(Delegate @delegate, string uri, string expectedResponse)
2108public void RequestDelegateThrowsWhenNullableParameterList(Delegate action)
2273public async Task CanInvokeFilter_OnFSharpAsyncOfTReturningHandler(Delegate @delegate)
2368public async Task CanInvokeFilter_OnVoidReturningHandler(Delegate @delegate)
2487public async Task CanInvokeFilter_OnHandlerReturningTasksOfStruct(Delegate @delegate)
Microsoft.AspNetCore.Http.Results.Tests (54)
ResultsOfTTests.Generated.cs (10)
212PopulateMetadata<Results<ProvidesMetadataResult1, ProvidesMetadataResult2>>(((Delegate)MyApi).GetMethodInfo(), builder);
224Assert.Throws<ArgumentNullException>("builder", () => PopulateMetadata<Results<ProvidesMetadataResult1, ProvidesMetadataResult2>>(((Delegate)GeneratedCodeIsUpToDate).GetMethodInfo(), null));
491PopulateMetadata<Results<ProvidesMetadataResult1, ProvidesMetadataResult2, ProvidesMetadataResult3>>(((Delegate)MyApi).GetMethodInfo(), builder);
504Assert.Throws<ArgumentNullException>("builder", () => PopulateMetadata<Results<ProvidesMetadataResult1, ProvidesMetadataResult2, ProvidesMetadataResult3>>(((Delegate)GeneratedCodeIsUpToDate).GetMethodInfo(), null));
847PopulateMetadata<Results<ProvidesMetadataResult1, ProvidesMetadataResult2, ProvidesMetadataResult3, ProvidesMetadataResult4>>(((Delegate)MyApi).GetMethodInfo(), builder);
861Assert.Throws<ArgumentNullException>("builder", () => PopulateMetadata<Results<ProvidesMetadataResult1, ProvidesMetadataResult2, ProvidesMetadataResult3, ProvidesMetadataResult4>>(((Delegate)GeneratedCodeIsUpToDate).GetMethodInfo(), null));
1288PopulateMetadata<Results<ProvidesMetadataResult1, ProvidesMetadataResult2, ProvidesMetadataResult3, ProvidesMetadataResult4, ProvidesMetadataResult5>>(((Delegate)MyApi).GetMethodInfo(), builder);
1303Assert.Throws<ArgumentNullException>("builder", () => PopulateMetadata<Results<ProvidesMetadataResult1, ProvidesMetadataResult2, ProvidesMetadataResult3, ProvidesMetadataResult4, ProvidesMetadataResult5>>(((Delegate)GeneratedCodeIsUpToDate).GetMethodInfo(), null));
1822PopulateMetadata<Results<ProvidesMetadataResult1, ProvidesMetadataResult2, ProvidesMetadataResult3, ProvidesMetadataResult4, ProvidesMetadataResult5, ProvidesMetadataResult6>>(((Delegate)MyApi).GetMethodInfo(), builder);
1838Assert.Throws<ArgumentNullException>("builder", () => PopulateMetadata<Results<ProvidesMetadataResult1, ProvidesMetadataResult2, ProvidesMetadataResult3, ProvidesMetadataResult4, ProvidesMetadataResult5, ProvidesMetadataResult6>>(((Delegate)GeneratedCodeIsUpToDate).GetMethodInfo(), null));
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (3)
Microsoft.AspNetCore.Mvc.Core (5)
Microsoft.AspNetCore.Mvc.IntegrationTests (2)
Microsoft.AspNetCore.Mvc.Test (1)
Microsoft.AspNetCore.OpenApi.Tests (9)
Microsoft.AspNetCore.Routing (28)
Microsoft.AspNetCore.Routing.Abstractions (4)
Microsoft.AspNetCore.Routing.Tests (16)
Builder\RouteHandlerEndpointRouteBuilderExtensionsTest.cs (16)
34IEndpointConventionBuilder MapGet(IEndpointRouteBuilder routes, string template, Delegate action) =>
37IEndpointConventionBuilder MapPost(IEndpointRouteBuilder routes, string template, Delegate action) =>
40IEndpointConventionBuilder MapPut(IEndpointRouteBuilder routes, string template, Delegate action) =>
43IEndpointConventionBuilder MapDelete(IEndpointRouteBuilder routes, string template, Delegate action) =>
46IEndpointConventionBuilder MapPatch(IEndpointRouteBuilder routes, string template, Delegate action) =>
49IEndpointConventionBuilder Map(IEndpointRouteBuilder routes, string template, Delegate action) =>
54new object?[] { (Func<IEndpointRouteBuilder, string, Delegate, IEndpointConventionBuilder>)MapGet, "GET" },
55new object?[] { (Func<IEndpointRouteBuilder, string, Delegate, IEndpointConventionBuilder>)MapPost, "POST" },
56new object?[] { (Func<IEndpointRouteBuilder, string, Delegate, IEndpointConventionBuilder>)MapPut, "PUT" },
57new object?[] { (Func<IEndpointRouteBuilder, string, Delegate, IEndpointConventionBuilder>)MapDelete, "DELETE" },
58new object?[] { (Func<IEndpointRouteBuilder, string, Delegate, IEndpointConventionBuilder>)MapPatch, "PATCH" },
59new object?[] { (Func<IEndpointRouteBuilder, string, Delegate, IEndpointConventionBuilder>)Map, null },
450public void MapVerbDoesNotDuplicateMetadata(Func<IEndpointRouteBuilder, string, Delegate, IEndpointConventionBuilder> map, string expectedMethod)
481public void AddingMetadataAfterBuildingEndpointThrows(Func<IEndpointRouteBuilder, string, Delegate, IEndpointConventionBuilder> map, string expectedMethod)
505public async Task MapVerbWithExplicitRouteParameterIsCaseInsensitive(Func<IEndpointRouteBuilder, string, Delegate, IEndpointConventionBuilder> map, string expectedMethod)
547public async Task MapVerbWithRouteParameterDoesNotFallbackToQuery(Func<IEndpointRouteBuilder, string, Delegate, IEndpointConventionBuilder> map, string expectedMethod)
Microsoft.AspNetCore.Shared.Tests (4)
Microsoft.Build (2)
Microsoft.CSharp (3)
Microsoft.DotNet.RemoteExecutor (2)
Microsoft.Win32.SystemEvents (1)
MSBuild (2)
MSBuildTaskHost (3)
mscorlib (1)
netstandard (1)
PresentationBuildTasks (5)
PresentationCore (124)
System\Windows\EventHelper.cs (10)
24public static void AddHandler<T>(ref Tuple<T, Delegate[]> field, T value) where T : Delegate
28Tuple<T, Delegate[]> oldTuple = field;
29T combinedDelegate = (T)Delegate.Combine(oldTuple?.Item1, value);
30Tuple<T, Delegate[]> newTuple = combinedDelegate != null ? Tuple.Create(combinedDelegate, combinedDelegate.GetInvocationList()) : null;
41public static void RemoveHandler<T>(ref Tuple<T, Delegate[]> field, T value) where T : Delegate
45Tuple<T, Delegate[]> oldTuple = field;
46T delegateWithRemoval = (T)Delegate.Remove(oldTuple?.Item1, value);
47Tuple<T, Delegate[]> newTuple = delegateWithRemoval != null ? Tuple.Create(delegateWithRemoval, delegateWithRemoval.GetInvocationList()) : null;
PresentationFramework (90)
System.ComponentModel.Composition (8)
System.ComponentModel.Composition.Registration (1)
System.ComponentModel.Primitives (9)
System.ComponentModel.TypeConverter (14)
System.Composition.Convention (1)
System.Configuration.ConfigurationManager (1)
System.Data.Odbc (2)
System.Linq.Expressions (26)
System\Dynamic\Utils\DelegateHelpers.cs (6)
23public static Func<Type, Func<object?[], object?>, Delegate> CreateObjectArrayDelegate { get; }
26private static Func<Type, Func<object?[], object?>, Delegate> CreateObjectArrayDelegateInternal()
35.CreateDelegate<Func<Type, Func<object?[], object?>, Delegate>>();
39return new Func<Type, Func<object?[], object?>, Delegate>((_x, _y) => throw new NotImplementedException());
55internal static Delegate CreateObjectArrayDelegate(Type delegateType, Func<object?[], object?> handler)
201private static Delegate CreateObjectArrayDelegateRefEmit(Type delegateType, Func<object?[], object?> handler)
System.Net.HttpListener (1)
System.Private.CoreLib (152)
src\libraries\System.Private.CoreLib\src\System\Delegate.cs (38)
18public static Delegate? Combine(Delegate? a, Delegate? b)
26public static Delegate? Combine(params Delegate?[]? delegates) =>
27Combine((ReadOnlySpan<Delegate?>)delegates);
38public static Delegate? Combine(params ReadOnlySpan<Delegate?> delegates)
40Delegate? d = null;
55public static Delegate CreateDelegate(Type type, object? firstArgument, MethodInfo method) => CreateDelegate(type, firstArgument, method, throwOnBindFailure: true)!;
58public static Delegate CreateDelegate(Type type, MethodInfo method) => CreateDelegate(type, method, throwOnBindFailure: true)!;
62public static Delegate CreateDelegate(Type type, object target, string method) => CreateDelegate(type, target, method, ignoreCase: false, throwOnBindFailure: true)!;
64public static Delegate CreateDelegate(Type type, object target, string method, bool ignoreCase) => CreateDelegate(type, target, method, ignoreCase, throwOnBindFailure: true)!;
67public static Delegate CreateDelegate(Type type, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type target, string method) => CreateDelegate(type, target, method, ignoreCase: false, throwOnBindFailure: true)!;
68public static Delegate CreateDelegate(Type type, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type target, string method, bool ignoreCase) => CreateDelegate(type, target, method, ignoreCase, throwOnBindFailure: true)!;
71protected virtual Delegate CombineImpl(Delegate? d) => throw new MulticastNotSupportedException(SR.Multicast_Combine);
73protected virtual Delegate? RemoveImpl(Delegate d) => d.Equals(this) ? null : this;
75public virtual Delegate[] GetInvocationList() => new Delegate[] { this };
78/// Gets a value that indicates whether the <see cref="Delegate"/> has a single invocation target.
80/// <value>true if the <see cref="Delegate"/> has a single invocation target.</value>
93public static System.Delegate.InvocationListEnumerator<TDelegate> EnumerateInvocationList<TDelegate>(TDelegate? d) where TDelegate : System.Delegate
100public struct InvocationListEnumerator<TDelegate> where TDelegate : System.Delegate
138public System.Delegate.InvocationListEnumerator<TDelegate> GetEnumerator() => this;
152public static Delegate? Remove(Delegate? source, Delegate? value)
166public static Delegate? RemoveAll(Delegate? source, Delegate? value)
168Delegate? newDelegate;
181public static bool operator ==(Delegate? d1, Delegate? d2)
194public static bool operator !=(Delegate? d1, Delegate? d2)
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (13)
125internal Delegate? m_action;
505internal Task(Delegate action, object? state, Task? parent, CancellationToken cancellationToken,
537internal void TaskConstructorCore(Delegate? action, object? state, CancellationToken cancellationToken,
1142Task? creatingTask, Delegate action, object? state, CancellationToken cancellationToken, TaskScheduler scheduler,
6986internal virtual Delegate[]? GetDelegateContinuationsForDebugger()
6995private static Delegate[]? GetDelegatesFromContinuationObject(object? continuationObject)
7001return new Delegate[] { AsyncMethodBuilderCore.TryGetStateMachineForDebugger(singleAction) };
7011Delegate[]? delegates = continuationTask.GetDelegateContinuationsForDebugger();
7020return new Delegate[] { new Action<Task>(singleCompletionAction.Invoke) };
7025List<Delegate> result = new List<Delegate>();
7028Delegate[]? innerDelegates = GetDelegatesFromContinuationObject(obj);
7031foreach (Delegate del in innerDelegates)
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\TaskContinuation.cs (9)
15Task antecedent, Delegate action, object? state, TaskCreationOptions creationOptions, InternalTaskOptions internalOptions) :
61Task antecedent, Delegate function, object? state, TaskCreationOptions creationOptions, InternalTaskOptions internalOptions) :
107Task<TAntecedentResult> antecedent, Delegate action, object? state, TaskCreationOptions creationOptions, InternalTaskOptions internalOptions) :
153Task<TAntecedentResult> antecedent, Delegate function, object? state, TaskCreationOptions creationOptions, InternalTaskOptions internalOptions) :
255internal abstract Delegate[]? GetDelegateContinuationsForDebugger();
357internal override Delegate[]? GetDelegateContinuationsForDebugger() =>
360new Delegate[] { m_task.m_action };
824internal override Delegate[] GetDelegateContinuationsForDebugger()
827return new Delegate[] { AsyncMethodBuilderCore.TryGetStateMachineForDebugger(m_action) };
src\System\Delegate.CoreCLR.cs (20)
94Delegate d = (Delegate)obj;
216public static Delegate? CreateDelegate(Type type, object target, string method, bool ignoreCase, bool throwOnBindFailure)
227Delegate d = InternalAlloc(rtType);
251public static Delegate? CreateDelegate(Type type, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type target, string method, bool ignoreCase, bool throwOnBindFailure)
267Delegate d = InternalAlloc(rtType);
287public static Delegate? CreateDelegate(Type type, MethodInfo method, bool throwOnBindFailure)
309Delegate? d = CreateDelegateInternal(
322public static Delegate? CreateDelegate(Type type, object? firstArgument, MethodInfo method, bool throwOnBindFailure)
341Delegate? d = CreateDelegateInternal(
358internal static Delegate CreateDelegateNoSecurityCheck(Type type, object? target, RuntimeMethodHandle method)
372Delegate d = InternalAlloc(rtType);
386internal static Delegate? CreateDelegateInternal(RuntimeType rtType, RuntimeMethodInfo rtMethod, object? firstArgument, DelegateBindingFlags flags)
388Delegate d = InternalAlloc(rtType);
406Delegate d = this;
417Delegate d = this;
483Delegate d = this;
492private static bool InternalEqualMethodHandles(Delegate left, Delegate right)
511Delegate d = this;
System.Private.DataContractSerialization (3)
System.Private.Xml (2)
System.Reflection.Context (6)
System.Reflection.MetadataLoadContext (4)
System.Runtime (1)
System.Runtime.InteropServices (2)
System.Runtime.Serialization.Formatters (2)
System.Security.Cryptography (1)
System.ServiceModel.Primitives (1)
System.ServiceModel.Syndication (2)
System.Text.Json (12)
System.Threading.Tasks.Dataflow (5)
System.Transactions.Local (6)
System.Windows.Controls.Ribbon (6)
System.Xaml (13)
System\Xaml\Runtime\DynamicMethodRuntime.cs (6)
44delegate Delegate DelegateCreator(Type delegateType, object target, string methodName);
178protected override Delegate CreateDelegate(Type delegateType, object target, string methodName)
284typeof(Delegate), typeof(Type), typeof(object), typeof(string));
292Emit_CastTo(ilGenerator, typeof(Delegate));
301typeof(Delegate), typeof(Type), typeof(object), typeof(string));
307MethodInfo method = typeof(Delegate).GetMethod(KnownStrings.CreateDelegate,
UIAutomationClient (16)
MS\Internal\Automation\ClientEventManager.cs (7)
47internal static void AddFocusListener(Delegate eventCallback, EventListener l)
54internal static void RemoveFocusListener(Delegate eventCallback)
61internal static void AddListener(AutomationElement rawEl, Delegate eventCallback, EventListener l)
155internal static void RemoveListener( AutomationEvent eventId, AutomationElement el, Delegate eventCallback )
476private static void AddRootListener(Tracker idx, Delegate eventCallback, EventListener l)
502private static void RemoveRootListener(AutomationEvent eventId, Tracker idx, Delegate eventCallback)
522private static void RemoveWinEventListener(Tracker idx, Delegate eventCallback)
WasmAppBuilder (1)