HI EVERY1:cool:
I'm really wondering if there is any program that has the ability to convert VB.NET Code to C# or vice versa , like upgrading VB6 TO VB.NET
Thanx guys:D
Printable View
HI EVERY1:cool:
I'm really wondering if there is any program that has the ability to convert VB.NET Code to C# or vice versa , like upgrading VB6 TO VB.NET
Thanx guys:D
Why do you want to do that? They can interoperate.Quote:
Originally posted by pirate
HI EVERY1:cool:
I'm really wondering if there is any program that has the ability to convert VB.NET Code to C# or vice versa , like upgrading VB6 TO VB.NET
Thanx guys:D
Well , I know that ;). Sometimes I find C# CODE and want ,for example a peice of that CODE in VB.NET .
No body answered yet .:o
thanx
You should just learn the C# syntax and translate it yourself, I think that is what most people are doing. Its really not hard.
I'll start you off:
VB Code:
'declaring a variable in vb Dim MyVar As Integer 'goes: [variablename] As [Type] 'now in C# Integer MyVar; 'goes: [Type] [variablename]; 'the semicolon is the line terminator in C# so just about every line has it at the end
______________________________________________Quote:
Originally posted by Edneeis
You should just learn the C# syntax and translate it yourself, I think that is what most people are doing. Its really not hard.
I'll start you off:
VB Code:
'declaring a variable in vb Dim MyVar As Integer 'goes: [variablename] As [Type] 'now in C# Integer MyVar; 'goes: [Type] [variablename]; 'the semicolon is the line terminator in C# so just about every line has it at the end
thanx Edneeis .
I found a lot of sites talking about C# for beginners but hoped I can find learning "C# in comparsion to VB". Just like the way you posted it .
one more question:D
if a vb project contained 10 lines of code , then after converting to C# must be 10 lines too ?
Maybe C# sometimes has more lines but usually less words:
VB Code:
'VB line count=7 Dim item As String For Each item In Items If item="MyItem" Then Msgbox("I Found It") Exit For End If Next //C# line count=7 foreach (string item in Items) { if (item=="MyItem") { MessageBox.Show("I Found It"); //I don't think C# has an Exit For command } }
Somethings are more lines because of the {} structure but that might be the only thing on a line. Also somethings are shorter or longer (i.e. doesn't need a seperate line in C# to declare the For item, but each Case in a Select Case needs a break; statement).
Instead of exit for, it is break in C#:
VB Code:
//C# line count=7 foreach (string item in Items) { if (item=="MyItem") { MessageBox.Show("I Found It"); break; } }
Also, when you type break in the IDE, it will show you which loop it is breaking out of by making it bold. I think that is pretty cool.
And just so you know, you have some flexibility with your coding style. C# doesn't care about white space. Since you use the ; at the end of a statement, you can seperate or compress your code to what ever you like. Example:
Doesn't look very readable though.Code:foreach (string item in Items){if (item=="MyItem"){MessageBox.Show("I Found It");break;}}
u can do that in vb too :D use the :
MsgBox(":D") : MsgBox(":D")
Didn't know that....
thanx all for the posts;) .I started learning C# .:D BYE BYE
yea...2 weeks ago i started switching from vb.net to C#...although at start it looked like a mess and ugly now i got used and already preferr it to vb.net :D
IF you have long xp in VB.NET then you swiched to C# , do you think 2 weeks enough to master both C# & VB.NET since both are similar;)
Not a chance in hell that you can master any language in two weeks..:rolleyes:
what if I said 2 years:D :D - Would be easy job;)
im reading a 900page book..i already had experience in vb.net so it's just a matter of sintax