Module.IsResource 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得值,指出物件是否為資源。
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