/
githubmirror
/
PowerShell
Обзор
Документация
Войти
/
githubmirror
/
PowerShell
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/System.Management.Automation/engine/ComInterop/SplatCallSite.cs
38 строк
1 KB
Dmitry Volodin
Use null-coalescing assignment in the rest of `/engine` (#17729)
26 июл 2022, 22:31
Не верифицирован
26 июл 2022, 22:31
1779175
Код
Авторство
О чём код?
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Diagnostics; using System.Runtime.CompilerServices; namespace System.Management.Automation.ComInterop { internal sealed class SplatCallSite { // Stored callable IDynamicMetaObjectProvider. internal readonly object _callable; // Can the number of arguments to a given event change each call? // If not, we don't need this level of indirection--we could cache a // delegate that does the splatting. private CallSite<Func<CallSite, object, object[], object>> _site; internal SplatCallSite(object callable) { Debug.Assert(callable != null); _callable = callable; } public delegate object InvokeDelegate(object[] args); internal object Invoke(object[] args) { Debug.Assert(args != null); // Create a CallSite and invoke it. _site ??= CallSite<Func<CallSite, object, object[], object>>.Create(SplatInvokeBinder.Instance); return _site.Target(_site, _callable, args); } } }