Intel® Software Network Knowledge Base Wiki


Constructing Nav Tree
One Moment...

(refresh menu)



 
Welcome, Guest | Quick Login | Register

.NET


How to Use a .NET Assembly

Version 3, Changed by KYLE LEWIS on 1/2/2008
Created by: KYLEX.S.LEWIS@INTEL.COM

Challenge

Use a .NET assembly. The following code shows a test application that exercises the CakeInfo assembly that was created in the separate item, "How to Create & Version a .NET Assembly." It is similar to the caketester application created in the item, "How to Use and Locate a UNIX (including Linux) Shared Library."

            using System
            using CakeUtils
            namespace SizeCake
               public class SizeTest
              
                  public static void Main(string [] args)
                  
                     short numEaters
                     numEaters = CakeInfo.FeedsHowMany(10, CakeShape.Hexagonal
                     CakeFilling.Sponge)
                     Console.WriteLine("This cake will feed " + numEaters +
                     " people."
                  
               

Solution

Compile the application using the following command:

			csc /r:CakeInfo.dll SizeCake.cs
The parameter to the command specifies that the program references the assembly. When the program runs, the output should be:

 

			This cake will feed 8 people.

 

This item is part of a larger body of items that contrast the ways in which versioning and dynamic linking are handled by Windows* and the .NET Common Language Runtime* (CLR), as opposed to by UNIX-based operating systems such as Linux* or Solaris.*

Source

Versioning, Libraries, and Assemblies

 



Served
23 Knowledge Bases
604 Pages
Search
Powering Up Search...


Vote on this Page

Tags For This Page
Loading Tags..

Tag This



Additional legal information