Module.Name Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
String
Mendapatkan yang mewakili nama modul dengan jalur dihapus.
public:
virtual property System::String ^ Name { System::String ^ get(); };
public:
property System::String ^ Name { System::String ^ get(); };
public virtual string Name { get; }
public string Name { get; }
member this.Name : string
Public Overridable ReadOnly Property Name As String
Public ReadOnly Property Name As String
Nilai Properti
Nama modul tanpa jalur.
Contoh
Contoh ini menunjukkan efek properti ScopeName
, FullyQualifiedName
, dan Name
.
using namespace System;
using namespace System::Reflection;
int main()
{
Module^ mod = Assembly::GetExecutingAssembly()->GetModules()[ 0 ];
Console::WriteLine( "Module Name is {0}", mod->Name );
Console::WriteLine( "Module FullyQualifiedName is {0}", mod->FullyQualifiedName );
Console::WriteLine( "Module ScopeName is {0}", mod->ScopeName );
}
/*
This code produces the following output:
Module Name is modname.exe
Module FullyQualifiedName is C:\Bin\modname.exe
Module ScopeName is modname.exe
*/
using System.Reflection;
using System;
public class Simple
{
public static void Main ()
{
Module mod = typeof(Simple).Assembly.GetModules () [0];
Console.WriteLine ("Module Name is " + mod.Name);
Console.WriteLine ("Module FullyQualifiedName is " + mod.FullyQualifiedName);
Console.WriteLine ("Module ScopeName is " + mod.ScopeName);
}
}
/*
This code produces output like the following:
Module Name is modname.exe
Module FullyQualifiedName is C:\Bin\modname.exe
Module ScopeName is modname.exe
*/
Imports System.Reflection
Public Class Simple
Public Shared Sub Main()
Dim myMod As System.Reflection.Module =
GetType(Simple).Assembly.GetModules()(0)
Console.WriteLine("Module Name is " + myMod.Name)
Console.WriteLine("Module FullyQualifiedName is " _
+ myMod.FullyQualifiedName)
Console.WriteLine("Module ScopeName is " + myMod.ScopeName)
End Sub
End Class
' This code produces output like the following:
' Module Name is modname.exe
' Module FullyQualifiedName is C:\Bin\modname.exe
' Module ScopeName is modname.exe
Keterangan
Name
adalah string yang bergantung pada platform.
Jika rakitan untuk modul ini dimuat dari array byte, maka FullyQualifiedName
untuk modul akan menjadi: <Tidak diketahui>.
Untuk mendapatkan nama dan jalur, gunakan FullyQualifiedName.