You use reflection to obtain a information about the method named "my method".You need to ascertain "mymethod is accessible to derived class?What should You do?
-
Call the ISAssembly property of the MethodInfo Class
-
Call the ISstatic property of the MethodInfo Class
-
Call the ISvirtual property of the MethodInfo Class
-
Call the ISFamily property of the MethodInfo Class
When using reflection in .NET to inspect method accessibility, the IsFamily property of the MethodInfo class indicates whether a method is accessible to derived classes (i.e., it's protected or family-access). This property returns true for protected methods, which can be called by derived classes but not from outside the class hierarchy. IsAssembly checks internal access, IsStatic checks for static methods, and IsVirtual checks for virtual methods - none of these indicate inheritance accessibility.
The MethodInfo.IsFamily property indicates whether a method has protected (family) accessibility, meaning it's accessible to derived classes but not to unrelated external code. Checking IsStatic or IsVirtual tells you about staticness or overridability, not accessibility to derived classes, and IsAssembly relates to internal (assembly-level) access rather than inheritance-based access — so IsFamily is the property that directly answers whether a method is visible to subclasses.