Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

SymLanguageType Class

Holds the public GUIDs for language types to be used with the symbol store.

For a list of all members of this type, see SymLanguageType Members.

System.Object
   System.Diagnostics.SymbolStore.SymLanguageType

[Visual Basic]
Public Class SymLanguageType
[C#]
public class SymLanguageType
[C++]
public __gc class SymLanguageType
[JScript]
public class SymLanguageType

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Example

[Visual Basic, C#, C++] The following code example demonstrates how SymLanguageType is used when calling DefineDocument.

[Visual Basic] 
Imports System
Imports System.Reflection
Imports System.Reflection.Emit
Imports System.Resources
Imports System.Diagnostics.SymbolStore

Namespace ILGenServer

   Public Class CodeGenerator
      Private myModuleBuilder As ModuleBuilder
      Private myAssemblyBuilder As AssemblyBuilder

      Public Sub New()

         ' Get the current application domain for the current thread.
         Dim currentDomain As AppDomain = AppDomain.CurrentDomain
         Dim myAssemblyName As New AssemblyName()
         myAssemblyName.Name = "TempAssembly"

         ' Define a dynamic assembly in the current domain.
         myAssemblyBuilder = currentDomain.DefineDynamicAssembly(myAssemblyName, _
                                                         AssemblyBuilderAccess.RunAndSave)
         ' Define a dynamic module in "TempAssembly" assembly.
         myModuleBuilder = myAssemblyBuilder.DefineDynamicModule("TempModule", "Resource.mod", True)

         ' Define a document for source.on 'TempModule' module.
         Dim myDocument As ISymbolDocumentWriter = myModuleBuilder.DefineDocument("RTAsm.il", _
                     SymDocumentType.Text, SymLanguageType.ILAssembly, SymLanguageVendor.Microsoft)
         Console.WriteLine("The object representing the defined document is:" + _
                                                             CObj(myDocument).ToString())

      End Sub 'New
   End Class 'CodeGenerator

   Public Class CallerClass

      Public Shared Sub Main()
         Dim myGenerator As New CodeGenerator()
      End Sub 'Main
   End Class 'CallerClass
End Namespace 'ILGenServer

[C#] 
using System;
using System.Reflection;
using System.Reflection.Emit;
using System.Resources;
using System.Diagnostics.SymbolStore;

namespace ILGenServer
{
   public class CodeGenerator
   {
      ModuleBuilder myModuleBuilder ;
      AssemblyBuilder myAssemblyBuilder ;

      public CodeGenerator()
      {

         // Get the current application domain for the current thread.
         AppDomain currentDomain = AppDomain.CurrentDomain;
         AssemblyName myAssemblyName = new AssemblyName();
         myAssemblyName.Name = "TempAssembly";

         // Define a dynamic assembly in the current domain.
         myAssemblyBuilder =
            currentDomain.DefineDynamicAssembly
                        (myAssemblyName, AssemblyBuilderAccess.RunAndSave);
         // Define a dynamic module in "TempAssembly" assembly.
         myModuleBuilder =
            myAssemblyBuilder.DefineDynamicModule("TempModule","Resource.mod",true);

         // Define a document for source.on 'TempModule' module.
         ISymbolDocumentWriter myDocument =
         myModuleBuilder.DefineDocument("RTAsm.il", SymDocumentType.Text,
                  SymLanguageType.ILAssembly,SymLanguageVendor.Microsoft);

         Console.WriteLine("The object representing the defined document is:"+myDocument);

      }
   }
   public class CallerClass
   {
      public static void Main()
      {
         CodeGenerator myGenerator = new CodeGenerator();
      }
   }
}

[C++] 
#using <mscorlib.dll>

using namespace System;
using namespace System::Reflection;
using namespace System::Reflection::Emit;
using namespace System::Resources;
using namespace System::Diagnostics::SymbolStore;

public __gc class CodeGenerator {
   ModuleBuilder* myModuleBuilder ;
   AssemblyBuilder* myAssemblyBuilder ;

public:
   CodeGenerator() {

      // Get the current application domain for the current thread.
      AppDomain*  currentDomain = AppDomain::CurrentDomain;
      AssemblyName* myAssemblyName = new AssemblyName();
      myAssemblyName->Name = S"TempAssembly";

      // Define a dynamic assembly in the current domain.
      myAssemblyBuilder =
         currentDomain->DefineDynamicAssembly
         (myAssemblyName, AssemblyBuilderAccess::RunAndSave);
      // Define a dynamic module in S"TempAssembly" assembly.
      myModuleBuilder =
         myAssemblyBuilder->DefineDynamicModule(S"TempModule", S"Resource.mod", true);

      // Define a document for source.on 'TempModule' module.
      ISymbolDocumentWriter* myDocument =
         myModuleBuilder->DefineDocument(S"RTAsm.il", SymDocumentType::Text,
         SymLanguageType::ILAssembly, SymLanguageVendor::Microsoft);

      Console::WriteLine(S"The object representing the defined document is: {0}", myDocument);

   }
};

int main() {
   CodeGenerator* myGenerator = new CodeGenerator();
}

[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

Namespace: System.Diagnostics.SymbolStore

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

Assembly: Mscorlib (in Mscorlib.dll)

See Also

SymLanguageType Members | System.Diagnostics.SymbolStore Namespace

Show:
© 2015 Microsoft