score:1

Accepted answer
var dogType = typeof(Dog);
var names = dogType.GetProperties()
                .Where(x => Attribute.IsDefined(x, typeof(TableField)))
                .Select(x => x.GetCustomAttribute<TableField>())
                .Where(x => x.Inoculated == true)
                .Select(x=>x.Name);

score:0

    public static Dictionary<string, string> GetDogNames()
    {
        var namesDict = new Dictionary<string, string>();

        var props = typeof(Dog).GetProperties();
        foreach (PropertyInfo prop in props)
        {
            object[] attrs = prop.GetCustomAttributes(true);
            foreach (object attr in attrs)
            {
                if (attr is TableField tableField && tableField.Inoculated)
                {
                    string propName = prop.Name;
                    string auth = tableField.Name;

                    namesDict.Add(propName, auth);
                }
            }
        }

        return namesDict;
    }

Related Query

More Query from same tag