GetValue(...) - Error is ignored in Runtime
===

Trying to create Enum extension method that gets any enum attribute value, I bumped in the following situation:

When compiling the code below VS 2010 shows an error of : No overload for method 'GetValue' takes 1 argument.
When commenting the code and using the watch tool - the line returns the value (see attached image).

Any idea why?


     public static class EnumExtensions
    {
        public static IEnumerable<object> GetAttributeValue(this Enum enm, Type attribute, string attributeName)
        {

            FieldInfo fi = enm.GetType().GetField(enm.ToString());

            var fiAtts = fi.GetCustomAttributes(attribute, false);

            if (fiAtts.Length == 0)
                return null;


            foreach (var att in fiAtts)
            {
                //VS2010 throws an error: No overload for method 'GetValue' takes 1 argument
                //yield ==> Ignore
                return att.GetType().GetProperty(attributeName).GetValue(att);
            }
        }
    }

![enter image description here][1]


  [1]: http://i.stack.imgur.com/msjHC.jpg