CSharp · Console
using System;
using System.Linq;
public class Program
{
class MyAttribute: Attribute { }
class MyClass
{
[MyAttribute]
public string MyProperty { get; set; }
}
public static void Main()
{
var attributes = typeof(MyClass).GetProperties().Where(x => x.GetCustomAttributes(typeof(MyAttribute), true).Any());
foreach (var attribute in attributes)
{
Console.WriteLine(attribute);
}
}
}