コード例 #1
0
        public void PrintMyClassCustomAttribute()
        {
            MyCustomAttribute[] myAttributes = AttributeHelpers.GetClassCustomAttributes <MyCustomAttribute>(typeof(SomeClass2));

            if (myAttributes == null)
            {
                Console.WriteLine("The Attributes were not found");
            }
            else
            {
                foreach (var myCustomAttribute in myAttributes)
                {
                    Console.WriteLine($"The Name is: {myCustomAttribute.Name}");
                    Console.WriteLine($"The Params are: {string.Join(", ", myCustomAttribute.Params)}");
                }
            }
        }