示例#1
0
        public void PrintMyCustomAttribute()
        {
            MyCustomAttribute myAttribute = AttributeHelpers.GetClassCustomAttribute <MyCustomAttribute>(typeof(SomeClass));

            if (myAttribute == null)
            {
                Console.WriteLine("The Attribute was not found");
            }
            else
            {
                Console.WriteLine($"The Name is: {myAttribute.Name}");
                Console.WriteLine($"The Params are: {string.Join(", ", myAttribute.Params)}");
            }
        }