You need to create a dynamic assembly named MyAssembly. You also need to save the assembly to disk. Which code segment should you use?

You need to create a dynamic assembly named MyAssembly. You also need to save the
assembly to disk. Which code segment should you use?

A. AssemblyName^ myAssemblyName = gcnew
    AssemblyName();myAssemblyName->Name = “MyAssembly”; AssemblyBuilder^
    myAssemblyBuilder =
    AppDomain::CurrentDomain->DefineDynamicAssembly(
    myAssemblyName,
    AssemblyBuilderAccess::Run);myAssemblyBuilder->Save(“MyAssembly.dll”);
B. AssemblyName^ myAssemblyName = gcnew
    AssemblyName();myAssemblyName->Name = “MyAssembly”; AssemblyBuilder^
    myAssemblyBuilder =
    AppDomain::CurrentDomain->DefineDynamicAssembly(
    myAssemblyName,
    AssemblyBuilderAccess::Save);myAssemblyBuilder->Save(“MyAssembly.dll”);
C. AssemblyName^ myAssemblyName = gcnew AssemblyName();AssemblyBuilder^
    myAssemblyBuilder =
    AppDomain::CurrentDomain->DefineDynamicAssembly(
    myAssemblyName,
    AssemblyBuilderAccess::RunAndSave);myAssemblyBuilder->Save(“MyAssembly.dll”);
D. AssemblyName^ myAssemblyName =
    gcnew AssemblyName(“MyAssembly”); AssemblyBuilder^ myAssemblyBuilder =
    AppDomain::CurrentDomain->DefineDynamicAssembly(
    myAssemblyName,
    AssemblyBuilderAccess::Save);myAssemblyBuilder->Save(“c:\\MyAssembly.dll”);


Answer: B 

No comments:

Post a Comment