Check out example codes for "csharp attributes as generics constraints". It will help you in understanding the concepts better.

Code Example 1

public static void Insert<T>(this IList<T> list, IList<T> items)
{
    var attributes = typeof(T).GetCustomAttributes(typeof(InsertableAttribute), true);

    if (attributes.Length == 0)
        throw new ArgumentException("T does not have attribute InsertableAttribute");

    /// Logic.
}

Learn ReactJs, React Native from akashmittal.com