Version 3.3.1.2

AttributeListExtensions class

Namespace: Sirenix.OdinInspector.Editor
Assembly: Sirenix.OdinInspector.Editor
public static class AttributeListExtensions
Extension method for List<Attribute>
Inheritance
  • System.Object
  • AttributeListExtensions

Methods

Add<T>(List<Attribute>)
Adds a new instance of the attribute to the list.
public static T Add<T>(this List<Attribute> attributeList)
    where T : Attribute, new()
Parameters
System.Collections.Generic.List<System.Attribute> attributeList

The attribute list.

Returns
T

Type Parameters
T

The type of attribute.

GetAttribute<T>(IList<Attribute>)
Gets the first instance of an attribute of the given type in the list.
public static T GetAttribute<T>(this IList<Attribute> attributeList)
    where T : Attribute
Parameters
System.Collections.Generic.IList<System.Attribute> attributeList

The attribute list.

Returns
T

Type Parameters
T

The type of attribute.

GetOrAddAttribute<T>(List<Attribute>)
Adds a new instance of the given type of attribute if it's not in the list.
public static T GetOrAddAttribute<T>(this List<Attribute> attributeList)
    where T : Attribute, new()
Parameters
System.Collections.Generic.List<System.Attribute> attributeList

The attribute list.

Returns
T

Type Parameters
T

The type of attribute.

HasAttribute<T>(IList<Attribute>)
Determines whether the list contains a specific attribute type.
public static bool HasAttribute<T>(this IList<Attribute> attributeList)
    where T : Attribute
Parameters
System.Collections.Generic.IList<System.Attribute> attributeList

The attribute list.

Returns
System.Boolean

true if the specified attribute list has attribute; otherwise, false.

Type Parameters
T

The type of attribute.

RemoveAttributeOfType<T>(List<Attribute>)
Removes all instances of the given type in the list.
public static bool RemoveAttributeOfType<T>(this List<Attribute> attributeList)
    where T : Attribute
Parameters
System.Collections.Generic.List<System.Attribute> attributeList

The attribute list.

Returns
System.Boolean

Type Parameters
T

The type of attribute.