Home HomeNovell Netware 5 Advanced Admin Instructor guideThomas Lemke Biopolitics. An Advanced IntroductionAdvanced 3D Game Programming with DirectX 9Advanced Perl ProgrammingTom Clancy Oblezenie v 110275994317 The 9 11 EncyclopediaMark W. Harris Historical Dictionary of Unitarian Universalism (2003)Grisham John Lawa przysieglych (2)Binek TadeuszZielona Mila
  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • nowepliki.pev.pl
  •  

    [ Pobierz całość w formacie PDF ]
    .From the command prompt,create the executable, as shown in the following code:c:\> csc /out:createaccount.exe *.csc:\> dir.createaccount.exe.11.From the command prompt, run ILDASM, passing the name of theexecutable as a command-line parameter, as follows:c:\> ildasm createaccount.exe12.Notice that the three classes and the enum are now listed inside theBanking namespace and that the CreateAccount class is present.13.Close ILDASM. 66 Module 11: Aggregation, Namespaces, and Advanced ScopeTo create and use a Banking library1.Open a Command window, and navigate to the install folder\Labs\Lab11\Exercise2\Starter \Bank folder.From the command prompt,create the banking library as follows:c:\> csc /target:library /out:bank.dll a*.cs b*.csc:\> dir.bank.dll.2.From the command prompt, run ILDASM, passing the name of the DLL asa command-line parameter, as follows:c:\> ildasm bank.dll3.Notice that the three  Bank* classes and the enum are still listed inside theBanking namespace, but the CreateAccount class is no longer present.Close ILDASM.4.From the command prompt, compile the test harness insideCreateAccount.cs into an assembly that references the Banking librarybank.dll, as follows:c:\> csc /reference:bank.dll createaccount.csc:\> dir.createaccount.exe.5.From the command prompt, run ILDASM, passing the name of theexecutable as a command-line parameter, as follows:c:\> ildasm createaccount.exe6.Notice that the four classes and the enum are no longer part ofcreateaccount.exe.Double-click the MANIFEST item in ILDASM to openthe Manifest window.Look at the manifest.Notice that the executablereferences, but does not contain, the banking library:.assembly extern bank7.Close ILDASM. Module 11: Aggregation, Namespaces, and Advanced Scope 67To simplify the test harness with a using-directive1.Edit CreateAccount.cs, and remove all occurrences of the Bankingnamespace.For example,static void write(Banking.BankAccount acc) {.}will becomestatic void write(BankAccount acc) {.}2.Save your work.3.Attempt to compile the program.It will fail to compile.Bank,BankAccount, and BankTransaction still cannot be found.4.Add to the beginning of CreateAccount.cs a using-directive that usesBanking, as follows:using System;using System.Collections;using Banking;5.Compile the program, correct any errors, and run the program.Verify thatSid s bank account is created and that the deposit and withdrawal appear inthe transaction list if they are successful. 68 Module 11: Aggregation, Namespaces, and Advanced ScopeTo investigate internal methods1.Edit the Main method in the CreateAccount.cs test harness.Add a singlestatement that creates a new BankTransaction object, as follows:static void Main( ){new BankTransaction(0.0M);.}2.Open a Command window, and navigate to the install folder\Labs\Lab11\Exercise2\Starter \Bank folder.From the command prompt, usethe following line of code to verify that you can create an executable thatdoes not use the banking library:c:\> csc /out:createaccount.exe *.cs3.From the command prompt, verify that you can create an executable thatdoes use the banking library:c:\> csc /target:library /out:bank.dll a*.cs b*.csc:\> csc /reference:bank.dll createaccount.cs4.The extra statement in Main will not create problems in either case.This isbecause the BankTransaction constructor in BankTransaction.cs iscurrently public.5.Edit the BankTransaction class in BankTransaction.cs so that itsconstructor and Dispose method have internal access.6.Save your work.7.From the command prompt, verify that you can still create an executablethat does not use the banking library:c:\> csc /out:createaccount.exe *.cs8.From the command prompt, verify that you cannot create an executable thatdoes use the banking library:c:\> csc /target:library /out:bank.dll a*.cs b*.csc:\> csc /reference:bank.dll createaccount.cs.error: Banking.BankTransaction.BankTransaction(decimal)is inaccessible because of its protection level9.Remove from CreateAccount.Main the extra statement that creates a newBankTransaction object.10.Verify that you can once again compile the test harness into an assemblythat references the Banking library:c:\> csc /target:library /out:bank.dll a*.cs b*.csc:\> csc /reference:bank.dll createaccount.cs Module 11: Aggregation, Namespaces, and Advanced Scope 69ReviewUsing Internal Classes, Methods, and DataUsing AggregationUsing NamespacesUsing Modules and Assemblies1.Imagine that you have two.cs files.The alpha.cs file contains a class calledAlpha that contains an internal method called Method.The beta.cs filecontains a class called Beta that also contains an internal method calledMethod.Can Alpha.Method be called from Beta.Method, and vice versa?2.Is aggregation an object relationship or a class relationship? 70 Module 11: Aggregation, Namespaces, and Advanced Scope3.Will the following code compile without error?namespace Outer.Inner{class Wibble { }}namespace Test{using Outer.Inner;class SpecialWibble: Inner.Wibble { }}4.Can a.NET executable program directly reference a.NET DLL module?THIS PAGE INTENTIONALLY LEFT BLANK [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • syriusz777.pev.pl
  •