3
Answers

Help creating main() to test my simple C#

Mezia

Mezia

16y
3.1k
1

I am new to .NET programming using Microsoft Visual Studio .NET 2008. As I am learning by coding from my C# book, I entered this simple C# program below:

namespace CSharpPropperty {

public class Person{

Int32 age;

public Int32 Age

{ // Property

get{

return age;}

set{ // validating value

if (value > 0 && value < 150){

age = value;}

else // throw exception

{throw new ArgumentException(" Invalid age");}

}

}

}

}

Now how do I create a main() routine or testdriver (in the Solution Explorer) to test the program above in the Microsoft Visual Studio 2008 IDE?

I continue to get this error message which says:

"In order to debug this project, add an executable project to this solution which references the library project. Set the executabelproject as the startup project."

The error message is simply asking I create a main() routine but how do I do that?Need help!

 

 

 

 

 

 

Answers (3)