This documentation is archived and is not being maintained.

Module.ScopeName Property

Gets a string representing the name of the module.

[Visual Basic]
Public ReadOnly Property ScopeName As String
[C#]
public string ScopeName {get;}
[C++]
public: __property String* get_ScopeName();
[JScript]
public function get ScopeName() : String;

Property Value

The module name.

Remarks

The ScopeName property is not used by the common language runtime, but you can use it to store any string you want in the property when you emit a module using the metadata APIs. Reflection itself does not allow you to set the ScopeName property.

Example

[Visual Basic, C#, C++] This example shows the effect of the ScopeName, FullyQualifiedName, and Name properties.

[Visual Basic] 
Imports System.Reflection
Imports System

Public Class Simple
    
    Public Shared Sub Main()
        Dim myMod As System.Reflection.Module = _
           [Assembly].GetExecutingAssembly().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

' Produces this output:
' Module Name is modname.exe
' Module FullyQualifiedName is C:\Bin\modname.exe
' Module ScopeName is modname.exe 

[C#] 
using System.Reflection;
using System;

public class Simple
{
   public static void Main ()
   {
        Module mod = Assembly.GetExecutingAssembly().GetModules () [0];
        Console.WriteLine ("Module Name is "
           + mod.Name);
        Console.WriteLine ("Module FullyQualifiedName is "
           + mod.FullyQualifiedName);
        Console.WriteLine ("Module ScopeName is "
           + mod.ScopeName);
   }
}
/*
Produces this output:
Module Name is modname.exe
Module FullyQualifiedName is C:\Bin\modname.exe
Module ScopeName is modname.exe
*/

[C++] 
#using <mscorlib.dll>
using namespace System;
using namespace System::Reflection;

int main ()
{
    Module* mod = Assembly::GetExecutingAssembly()->GetModules () [0];
    Console::WriteLine (S"Module Name is {0}", mod->Name);
    Console::WriteLine (S"Module FullyQualifiedName is {0}", mod->FullyQualifiedName);
    Console::WriteLine (S"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
*/

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Module Class | Module Members | System.Reflection Namespace

Show: