mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-01-08 10:33:52 +08:00
Update Extensions.cs
This commit is contained in:
parent
f1b83e7c9e
commit
6a47e542e5
@ -36,27 +36,6 @@ namespace UnityExplorer
|
|||||||
|
|
||||||
// ------- Misc extensions --------
|
// ------- Misc extensions --------
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Recursively check the type and its base types to find any generic arguments.
|
|
||||||
/// </summary>
|
|
||||||
public static bool TryGetGenericArguments(this Type type, out Type[] args)
|
|
||||||
{
|
|
||||||
if (type.IsGenericType)
|
|
||||||
{
|
|
||||||
args = type.GetGenericArguments();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (type.BaseType != null)
|
|
||||||
{
|
|
||||||
return TryGetGenericArguments(type.BaseType, out args);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
args = null;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Safely try to get all Types inside an Assembly.
|
/// Safely try to get all Types inside an Assembly.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user