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

Commit

Permalink
Update IsAnonymous
Browse files Browse the repository at this point in the history
  • Loading branch information
uurha committed Feb 29, 2024
1 parent f955839 commit 0dd82d2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
12 changes: 4 additions & 8 deletions Assets/BetterExtensions/Runtime/Extensions/TypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,12 @@ public static IEnumerable<Type> GetAllInheritedTypesWithoutUnityObject(this Type

public static bool IsAnonymous(this Type type)
{
if (type.IsGenericType)
if (type.IsClass && type.IsSealed && type.Attributes.HasFlag(TypeAttributes.NotPublic))
{
var d = type.GetGenericTypeDefinition();
if (d.IsClass && d.IsSealed && d.Attributes.HasFlag(TypeAttributes.NotPublic))
var attributes = type.GetCustomAttribute<CompilerGeneratedAttribute>(false);
if (attributes != null)
{
var attributes = d.GetCustomAttribute<CompilerGeneratedAttribute>(false);
if (attributes != null)
{
return true;
}
return true;
}
}

Expand Down
2 changes: 1 addition & 1 deletion Assets/BetterExtensions/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.uurha.betterextensions",
"displayName": "Better Extensions",
"version": "1.5.4",
"version": "1.5.5",
"unity": "2020.1",
"description": "Unity extensions, serialize extension, async extension, string extension and UI extensions",
"dependencies": {
Expand Down

0 comments on commit 0dd82d2

Please sign in to comment.