Dim x As Integer = 5
Console.WriteLine("The secret number is: " & x)
End Sub
End Module
FIGURE 1: Sample VB .NET code.
As you can see, VB .NET now allows you to initialize variable values at declaration. The next line uses the WriteLine method of the Console class. There is some simple string concatenation, and the string is printed to the console (or the DOS window or command window).
FIGURE 2 shows the same application written in C#. The variable declaration is cleaner, but the Console.WriteLine is almost identical. Notice the curly braces and semicolons in the C# program, which are familiar to C/C and Java developers.
using System;
namespace ConsoleApplication3
{
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




