Module.ScopeName 属性

定义

获取表示模块名的字符串。

public:
 virtual property System::String ^ ScopeName { System::String ^ get(); };
public:
 property System::String ^ ScopeName { System::String ^ get(); };
public virtual string ScopeName { get; }
public string ScopeName { get; }
member this.ScopeName : string
Public Overridable ReadOnly Property ScopeName As String
Public ReadOnly Property ScopeName As String

属性值

模块名。

示例

此示例演示 、 FullyQualifiedNameName 属性的效果ScopeName

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 );
}

/*
Produces this 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);
   }
}
/*
The example displays output like the folloowing:
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 [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
' The example displays output like the following:
' Module Name is modname.exe
' Module FullyQualifiedName is C:\Bin\modname.exe
' Module ScopeName is modname.exe

注解

公共 ScopeName 语言运行时不使用 属性,但在使用元数据 API 发出模块时,可以使用它来存储属性中所需的任何字符串。 反射本身不允许设置 ScopeName 属性。

适用于