What is an equivalent method to `GetCustomAttributes` for .NETCore (Windows 8 Framework)?

You need to use type.GetTypeInfo(), which then has various GetCustomAttribute methods (via extension methods), or there is .CustomAttributes which gives you the raw information (rather than materialized Attribute instances).

For example:

var attribute = type.GetTypeInfo().GetCustomAttribute<WrapperObjectAttribute>();
if(attribute == null)
{
    ...
}
...

GetTypeInfo() is the pain of .NETCore for library authors ;p

If .GetTypeInfo() doesn’t appear, then add a using System.Reflection; directive.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)