See the question and my original answer on StackOverflow

You would use the Attribute.GetCustomAttributes Method, with the overload that matches the object where the attribute has been set.

For example if the attribute is set on a method, something like:

MethodInfo mInfo = myClass.GetMethod("MyMethod");
foreach(Attribute attr in Attribute.GetCustomAttributes(mInfo))
{
   if (attr.GetType() == typeof(EntityBindingAttribute))
   {
     int i = ((EntityBindingAttribute)attr).I);
    }
}