Lollipop

Welcome to PcCare.com

.Net Sample Code

 

 

complex.cs
using System;
using System.Reflection;
using System.Security.Permissions;
using System.Runtime.CompilerServices;


[assembly: AssemblyVersion("0.0.0.8")]

namespace MathTest
{

	public class ComplexMath
	{
		public int Square(int a)
	        {
			return( a * a);
		}
	}
}

 

MathDemo.cs

using System;
using System.Reflection;
using System.Security.Permissions;
using System.Runtime.CompilerServices;

[assembly: AssemblyVersion("0.0.0.1")]


namespace MathTest
{

 class MyApp
 {

  static void Main()
  {

 
   ComplexMath complex = new ComplexMath();
   int square = complex.Square(3);
   Console.WriteLine("3 squared = {0}",square);
  }

 }
}

 

To Compile
  • Start->Visual Studio 2008->Visual Studio tools->Visual Studio 2008 command prompt.

  • Create complex.cs and MathDemo.cs from code above.

  • csc /target:library /out:math.dll complex.cs

  • csc /target:exe /reference:math.dll MathDemo.cs

 

  • To run app type MathDemo.exe, 3 squared = 9

 

 

DISCLAIMER: It is assumed that users are familiar with the operating system they are using and comfortable with making the suggested changes. PcCare.com will not be held responsible if changes you make cause a system failure.

Please review our Terms of Service and Privacy statement before initiating service or using this site. Microsoft® and the Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. PcCare Site Map. About Us