Vis studio -- how to test simple code


I’m going thru an 4 book, and I’m at a part about classes and their properties and functions. But up to now, all the examples involve a web_site, with controls, code_behind files, CSS, etc.

But, I get to places where I don’t understand the examples, so I look out on the web for other resources. For example, I found the code below to demonstrate the “ToString” function.

My problem is, I’m not sure know how to test a little piece of code like this. Can’t I just open up an application or project or something, paste this in and run it?

Module Module1

Class Perl

Dim _a As Integer
Dim _b As Integer

Public Sub New(ByVal a As Integer, ByVal b As Integer)
    _a = a
    _b = b
End Sub

Public Overrides Function ToString() As String
    Return String.Format("[{0}, {1}]", _a, _b)
End Function

End Class

Sub Main()
Dim p As Perl = New Perl(2, 3)
End Sub

End Module

Hi. Yes, you can test this in an IDE called Visual Studio 2010. In it, you can debug applications and execute your project within the program itself.

Good Luck.

Yes, I have that, but I guess my problem is it’s so big, I don’t know what to do to just bring in that code and test it. For example, it first asks if I want open a new project, existing project, new website, existing web site.

If I open a project, then my choices are web application, class library, MVC 2 Web Application, Silverlight Application, Silverlight Class Library, WCF Service Application, ASP.NET Dynamic Data entities Web Application or Enable Windows Azure Tools…NONE of these sound like what I want.

On the other hand, if I open a Site, then my choices are web site, empty web site, dynamic data entities web site, dynamic data linq to sql web site, and wcf service…THESE don’t sound right either.

Could you guide me thru the steps I need to take in order to setup this test?