Freigeben über


Module.IsResource Methode

Definition

Ruft einen Wert ab, der angibt, ob das Objekt eine Ressource ist.

public:
 virtual bool IsResource();
public:
 bool IsResource();
public virtual bool IsResource ();
public bool IsResource ();
abstract member IsResource : unit -> bool
override this.IsResource : unit -> bool
member this.IsResource : unit -> bool
Public Overridable Function IsResource () As Boolean
Public Function IsResource () As Boolean

Gibt zurück

true, wenn das Objekt eine Ressource ist, andernfalls false.

Beispiele

Im folgenden Beispiel wird die Verwendung der IsResource -Methode veranschaulicht.

using namespace System;
using namespace System::Reflection;
int main()
{
   array<Module^>^moduleArray;
   moduleArray = Assembly::GetExecutingAssembly()->GetModules( false );
   
   //In a simple project with only one module, the module at index
   // 0 will be the module containing this class.
   Module^ myModule = moduleArray[ 0 ];
   Console::WriteLine( "myModule->IsResource() = {0}", myModule->IsResource() );
}
using System;
using System.Reflection;

namespace ReflectionModule_Examples
{
    class MyMainClass
    {
        static void Main()
        {
            Module[] moduleArray;
            
            moduleArray = typeof(MyMainClass).Assembly.GetModules(false);
            
            //In a simple project with only one module, the module at index
            // 0 will be the module containing this class.
            Module myModule = moduleArray[0];

            Console.WriteLine("myModule.IsResource() = {0}", myModule.IsResource());
        }
    }
}
Imports System.Reflection

Namespace ReflectionModule_Examples
    Class MyMainClass
        Shared Sub Main()
            Dim moduleArray() As [Module]

            moduleArray = GetType(MyMainClass).Assembly.GetModules(False)

            'In a simple project with only one module, the module at index
            ' 0 will be the module containing this class.
            Dim myModule As [Module] = moduleArray(0)

            Console.WriteLine("myModule.IsResource() = {0}", myModule.IsResource())
        End Sub
    End Class
End Namespace 'ReflectionModule_Examples

Gilt für: