Module.Assembly 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
public:
virtual property System::Reflection::Assembly ^ Assembly { System::Reflection::Assembly ^ get(); };
public:
property System::Reflection::Assembly ^ Assembly { System::Reflection::Assembly ^ get(); };
public virtual System.Reflection.Assembly Assembly { get; }
public System.Reflection.Assembly Assembly { get; }
member this.Assembly : System.Reflection.Assembly
Public Overridable ReadOnly Property Assembly As Assembly
Public ReadOnly Property Assembly As Assembly
屬性值
Assembly
物件。
範例
下列範例會在指定的模組中顯示指定元件的完整名稱。
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 ];
Assembly^ myAssembly = myModule->Assembly;
Console::WriteLine( "myModule.Assembly = {0}.", myAssembly->FullName );
}
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];
Assembly myAssembly = myModule.Assembly;
Console.WriteLine("myModule.Assembly = {0}.", myAssembly.FullName);
}
}
}
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)
Dim myAssembly As [Assembly] = myModule.Assembly
Console.WriteLine("myModule.Assembly = {0}.", myAssembly.FullName)
End Sub
End Class
End Namespace 'ReflectionModule_Examples