mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-15 20:54:58 +00:00
feat: shim for platform independent delegate creation
This commit is contained in:
@@ -387,5 +387,23 @@ namespace ICD.Common.Utils
|
|||||||
|
|
||||||
return Convert.ChangeType(value, type, null);
|
return Convert.ChangeType(value, type, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Platform independant delegate instantiation.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <param name="firstArgument"></param>
|
||||||
|
/// <param name="method"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Delegate CreateDelegate(Type type, object firstArgument, MethodInfo method)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
#if SIMPLSHARP
|
||||||
|
CDelegate
|
||||||
|
#else
|
||||||
|
Delegate
|
||||||
|
#endif
|
||||||
|
.CreateDelegate(type, firstArgument, method);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user