Version 2.1.0.0

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 the attribute if not exist.
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>)
Adds the attribute if not exist.
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 the attribute if not exist.
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.

GetOrAddAttribute<T>(List<Attribute>, T)
Adds the attribute if not exist.
public static bool GetOrAddAttribute<T>(this List<Attribute> attributeList, T attr)
    where T : Attribute
Parameters
System.Collections.Generic.List<System.Attribute> attributeList

The attribute list.

T attr

The attribute.

Returns
System.Boolean

Type Parameters
T

The type of attribute.

HasAttribute<T>(IList<Attribute>)
Determines whether the list contains a specific attribute.
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 the type of the attribute of.
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.

This website is brand new and built with the Odin 2.1 beta in mind. This means you might discover some features such as attribute expressions that are only available in the beta.

You can download the 2.1 beta from here and read the patch-notes here.