Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #39 from uurha/dev
Browse files Browse the repository at this point in the history
Update ReflectionExtensions.cs
  • Loading branch information
uurha committed Jun 5, 2023
1 parent 2ab0762 commit 59f30a1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion Runtime/Extension/ReflectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static bool IsArrayOrList(this Type listType)

return false;
}

public static Type[] GetAllInheritedType(this Type baseType)
{
return AppDomain.CurrentDomain.GetAssemblies().SelectMany(s => s.GetTypes()).Where(p => ArgIsValueType(baseType, p)).ToArray();
Expand Down Expand Up @@ -54,6 +54,14 @@ public static Type GetArrayOrListElementType(this Type listType)
return null;
}

public static Type GetFieldOrElementType(this FieldInfo fieldInfo)
{
if (fieldInfo.IsArrayOrList())
return fieldInfo.GetArrayOrListElementType();

return fieldInfo.FieldType;
}

public static bool IsArrayOrList(this FieldInfo fieldInfo)
{
if (fieldInfo == null)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "com.uurha.betterextensions",
"displayName": "Better Extensions",
"description": "Unity extensions, serialize extension, async extension, string extension and UI extensions",
"version": "1.1.4",
"version": "1.1.5",
"unity": "2020.1",
"author": {
"name": "Arcueid D'athemon",
Expand Down

0 comments on commit 59f30a1

Please sign in to comment.