You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Return type implies it could return null elements in result list - it is correct signature and if so, when it could return nulls?
/// <summary>/// Get an enumeration of services of type <paramref name="serviceType"/> from the <see cref="IServiceProvider"/>./// </summary>/// <param name="provider">The <see cref="IServiceProvider"/> to retrieve the services from.</param>/// <param name="serviceType">An object that specifies the type of service object to get.</param>/// <returns>An enumeration of services of type <paramref name="serviceType"/>.</returns>[RequiresDynamicCode("The native code for an IEnumerable<serviceType> might not be available at runtime.")]publicstaticIEnumerable<object?>GetServices(thisIServiceProviderprovider,TypeserviceType){ThrowHelper.ThrowIfNull(provider);ThrowHelper.ThrowIfNull(serviceType);Type?genericEnumerable=typeof(IEnumerable<>).MakeGenericType(serviceType);return(IEnumerable<object>)provider.GetRequiredService(genericEnumerable);}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Return type implies it could return
null
elements in result list - it is correct signature and if so, when it could returnnull
s?https://github.com/dotnet/runtime/blob/main/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/ServiceProviderServiceExtensions.cs#L88-L94
annotation was introduced here but there is no discussions of this specific change
Beta Was this translation helpful? Give feedback.
All reactions