Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
6Activity
0 of .
Results for:
No results containing your search query
P. 1
Cheatsheet Csharp VBnet Compare

Cheatsheet Csharp VBnet Compare

Ratings:

5.0

(1)
|Views: 465|Likes:
Published by api-3751062
Comparativa entre C# y VB .Net
Comparativa entre C# y VB .Net

More info:

Published by: api-3751062 on Oct 15, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

03/18/2014

pdf

text

original

This document is an authorized derivative of Frank McCown's "VB.NET and
C# Comparison" (C) 2005 at
http://www.harding.edu/USER/fmccown/WWW/vbnet_csharp_comparison.html
This work is licensed under a Create Common License
Com m ents
VB.NET
'Single line only
Rem Single line only
C#

// Single line
/* Multiple
line */

/// XML comments on single line
/** XML comments on multiple lines */
Program Structure
VB.NET
ImportsSystem
NamespaceMyNameSpace
ClassHelloWorld
'Entry point which delegates to C-style main
Private Function
Public Overloads Shared SubMain()
Main(System.Environment.GetCommandLineArgs())
End Sub
Overloads Shared SubMain(args() As String)
System.Console.WriteLine("Hello World")
End Sub'Main
End Class 'HelloWorld End Namespace 'MyNameSpace
C#
usingSystem
Namespace MyNameSpace
{
classHelloWorld
{
static voidMain(string[] args)
{
System.Console.WriteLine("Hello
World")
}
}
}
This document is an authorized derivative of Frank McCown's "VB.NET and
C# Comparison" (C) 2005 at
http://www.harding.edu/USER/fmccown/WWW/vbnet_csharp_comparison.html
This work is licensed under a Create Common License
Data Types
VB.NET
'Value Types

Boolean
Byte
Char(example:"A")
Short, Integer, Long
Single, Double
Decimal
Date

'Reference Types
Object
String
Dimx As Integer
System.Console.WriteLine(x.GetType())
System.Console.WriteLine(TypeName(x))
'Type conversion
Dimd As Single= 3.5
Dimi As Integer= CType(d, Integer)
i= CInt (d)
i= Int(d)
C#
//Value Types

bool
byte, sbyte
char (example: 'A')
short, ushort, int, uint, long, ulong
float, double
decimal

DateTime
//Reference Types
object
string
intx;
Console.WriteLine(x.GetType())
Console.WriteLine(typeof(int))
//Type conversion
floatd= 3.5;
inti= (int)d
Constants
VB.NET
ConstMAX_AUTHORS As Integer= 25
ReadOnlyMIN_RANK As Single= 5.00
C#
const intMAX_AUTHORS= 25;
readonly floatMIN_RANKING= 5.00;
This document is an authorized derivative of Frank McCown's "VB.NET and
C# Comparison" (C) 2005 at
http://www.harding.edu/USER/fmccown/WWW/vbnet_csharp_comparison.html
This work is licensed under a Create Common License
Enum erations
VB.NET
EnumAction
Start
'Stop is a reserved word

[Stop]
Rewind
Forward

End Enum
EnumStatus

Flunk= 50
Pass= 70
Excel= 90

End Enum
Dima AsAction= Action.Stop
If a <> Action.Start Then_
'Prints "Stop is 1"
System.Console.WriteLine(a.ToString & " is " &
a)
'Prints 70
System.Console.WriteLine(Status.Pass)
'Prints Pass
System.Console.WriteLine(Status.Pass.ToString())
EnumWeekdays

Saturday
Sunday
Monday
Tuesday
Wednesday
Thursday
Friday

End Enum'Weekdays
C#
enum Action {Start, Stop, Rewind, Forward};
enum Status {Flunk= 50, Pass= 70, Excel=
90};
Action a= Action.Stop;
if (a != Action.Start)
//Prints "Stop is 1"
System.Console.WriteLine(a+ " is " +
(int) a);
// Prints 70
System.Console.WriteLine((int)
Status.Pass);
// Prints Pass
System.Console.WriteLine(Status.Pass);
enumWeekdays
{

Saturday, Sunday, Monday, Tuesday,
Wednesday, Thursday, Friday
}

Activity (6)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
kurozakura21 liked this
myapit liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->