NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

MethodBase.IsAssembly

Retrieves whether this is an abstract method.

[Visual Basic]
Public ReadOnly Property IsAssembly As Boolean
[C#]
public bool IsAssembly {get;}
[C++]
public: __property bool get_IsAssembly();
[JScript]
public function get IsAssembly() : Boolean;

Property Value

Read-only.

true if access to this method is restricted to the class itself and to other classes in the same assembly; otherwise, false.

Remarks

If set, this method can be called by other classes in the same assembly.

To get the MethodBase, first get the type. From the type, get the method. From the method, get the Methodbase. If the method base is other than a public method, it is protected and cannot be readily accessed. To access a non public method, in the GetMethod method, set the BindingFlags to NonPublic.

Example [C#]

[C#]

class methodbase
{
   public static int Main(string[] args)

      Console.WriteLine ("\nReflection.MethodBase");
      
      //Get the MethodBase of two methods.

      //Get the types
      Type MyType1 = Type.GetType("System.Runtime.Serialization.Formatter");
      Type MyType2 = Type.GetType("System.Variant");

      //Get and display the methods and the IsAssembly
      MethodBase Mymethodbase1 = 
         MyType1.GetMethod("WriteInt32",BindingFlags.NonPublic);
      MethodBase Mymethodbase2 = 
         MyType2.GetMethod("SetFieldsObject", BindingFlags.NonPublic);

      Console.Write("\nMymethodbase = " + Mymethodbase1);
      if (Mymethodbase1.IsAssembly)
         Console.Write ("\nMymethodbase is an assembly method");
      else
         Console.Write ("\nMymethodbase is not an assembly method");

      Console.Write("\n\nMymethodbase = " + Mymethodbase2);
      if (Mymethodbase2.IsAssembly)
         Console.Write ("\nMymethodbase is an assembly method");
      else
         Console.Write ("\nMymethodbase is not an assembly method");
      
      return 0;
   }
}
Produces the following output
Reflection.MethodBase

Mymethodbase = Void WriteInt32 (Int32, System.String)
Mymethodbase is not an assembly method

Mymethodbase = Void SetFieldsObject (System.Object)
Mymethodbase is an assembly method

See Also

MethodBase Class | MethodBase Members | System.Reflection Namespace | FieldAttributes | Boolean | BindingFlags