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
3Activity
0 of .
Results for:
No results containing your search query
P. 1
VBNet&CSharp Difference Reference

VBNet&CSharp Difference Reference

Ratings: (0)|Views: 62|Likes:
Published by nomaddarcy

More info:

Published by: nomaddarcy on Sep 29, 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

12/13/2014

pdf

text

original

 
1
 
VB.NET & C# QUICK REFERENCE CARD
Comments
 
VB.NET
 
'Single line only
 
Rem Singleline 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 mainPrivate 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("HelloWorld")
 
}
 
}
 
}
 
Data Types
 
VB.NET
 
'Value Types
 
Boolean
 
Byte
 
Char(example:"A")
 
Short,Integer,Long
 
Single,Double
 
Decimal
 
Date 'Reference Types
 
Object
 
String
 
DimxAs Integer
 
System.Console.WriteLine(x.GetType())
 
System.Console.WriteLine(TypeName(x))'Type conversion
 
DimdAs Single =3.5
 
DimiAs 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
 
 
2
 
Constants
 
VB.NET
 
ConstMAX_AUTHORSAs Integer =25
 
ReadOnlyMIN_RANKAs Single =5.00
 
C#
const intMAX_AUTHORS=25;
 
readonly floatMIN_RANKING=5.00;
 
Enumerations
 
VB.NET
 
EnumAction
 
Start
 
'Stop is a reserved word
 
[Stop]
 
Rewind
 
Forward
 
End Enum
 
EnumStatus
 
Flunk=50
 
Pass=70
 
Excel=90
 
End Enum
 
DimaAsAction=Action.Stop  Ifa <> Action.StartThen_
 
'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#
enumAction {Start, Stop, Rewind, Forward};
 
enumStatus {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
 
}
 
 
3
 
Operators
 
VB.NET
 
'Comparison
 
=< > <= >= <>'Arithmetic
 
+ - * /
 
Mod
 
\ (integerdivision)
 
^ (raise toa power) 'Assignment
 
=+= -= *= /= \=^=<<= >>= &= 'Bitwise
 
And AndAlso Or OrElse Not<< >> 'Logical
 
And AndAlso Or OrElse Not  'String Concatenation
 
&
C#
//Comparison
 
== < > <= >= != //Arithmetic
 
+ - * /
 
%(mod)
 
/(integer divisionifboth operands are ints)
 
Math.Pow(x, y)//Assignment
 
=+= -= *= /= %= &= |= ^=<<= >>= ++ -- //Bitwise
 
&|^ ~ << >>//Logical
 
&& || !//String Concatenation
 
+
 

Activity (3)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
ameshlal 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)//-->