Module.IsResource 方法

定义

获取一个值,该值指示此对象是否是资源。

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

返回

如果此对象是资源,则为 true;否则为 false

示例

下面的示例演示如何使用 IsResource 方法。

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

适用于