Given a property in a class, with attributes - what is the fastest way to determine if it contains a given attribute? For example:
[IsNotNullable] [I
This can now be done without expression trees and extension methods in a type safe manner with the new C# feature nameof() like this:
nameof()
Attribute.IsDefined(typeof(YourClass).GetProperty(nameof(YourClass.Id)), typeof(IsIdentity));
nameof() was introduced in C# 6