mirror of
https://github.com/codewriter-packages/Tri-Inspector.git
synced 2025-01-22 08:18:49 -05:00
24 lines
576 B
C#
24 lines
576 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace TriInspector.Utilities
|
|
{
|
|
internal static class TriAttributeUtilities
|
|
{
|
|
public static bool TryGet<T>(this IReadOnlyList<Attribute> attributes, out T it)
|
|
where T : Attribute
|
|
{
|
|
foreach (var attribute in attributes)
|
|
{
|
|
if (attribute is T typeAttribute)
|
|
{
|
|
it = typeAttribute;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
it = null;
|
|
return false;
|
|
}
|
|
}
|
|
} |