您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
22 行
836 B
22 行
836 B
using System;
|
|
|
|
namespace UnityEngine.Experimental.Rendering
|
|
{
|
|
public static class DelegateUtility
|
|
{
|
|
public static Delegate Cast(Delegate source, Type type)
|
|
{
|
|
if (source == null)
|
|
return null;
|
|
Delegate[] delegates = source.GetInvocationList();
|
|
if (delegates.Length == 1)
|
|
return Delegate.CreateDelegate(type,
|
|
delegates[0].Target, delegates[0].Method);
|
|
Delegate[] delegatesDest = new Delegate[delegates.Length];
|
|
for (int nDelegate = 0; nDelegate < delegates.Length; nDelegate++)
|
|
delegatesDest[nDelegate] = Delegate.CreateDelegate(type,
|
|
delegates[nDelegate].Target, delegates[nDelegate].Method);
|
|
return Delegate.Combine(delegatesDest);
|
|
}
|
|
}
|
|
}
|