25
7,751,202 members and growing! (38,105 online) Parte superior do formulário Email Password Sign in  Reme mber me? Lost password? Parte inferior do formulário Home Articles Chapters and Sections Search Latest Articles Latest Tips/Tricks Top Articles Beginner Articles Video Articles Technical Blogs Post an Article Post Tip & Trick Post your Blog Posting/Update Guidelines Article Competition Questions & Answers Ask a Question about this article Quick Answers Ask a Question View Unanswered Questions View All Questions... C# questions ASP.NET questions

Comparison Between C# and VB

Embed Size (px)

Citation preview

Page 1: Comparison Between C# and VB

8/6/2019 Comparison Between C# and VB

http://slidepdf.com/reader/full/comparison-between-c-and-vb 1/25

7,751,202 members and growing! (38,105 online)Parte superior do formulário

Email Password

Sign in

Remember me? Lost password?

Parte inferior do formulário

• Home• Articles

○ Chapters and Sections

○ Search

○ Latest Articles

○ Latest Tips/Tricks

○ Top Articles

○ Beginner Articles

○ Video Articles

○ Technical Blogs

○ Post an Article

○ Post Tip & Trick

○ Post your Blog

○ Posting/Update Guidelines

○ Article Competition• Questions & Answers

○ Ask a Question about this article

○ Quick Answers

○ Ask a Question

○ View Unanswered Questions

○ View All Questions...

○ C# questions

○ ASP.NET questions

Page 2: Comparison Between C# and VB

8/6/2019 Comparison Between C# and VB

http://slidepdf.com/reader/full/comparison-between-c-and-vb 2/25

○ VB.NET questions

○ C++ questions

○ C#3.0 questions

○ Programming Discussions

○ All Message Boards... ○ Application Lifecycle >

Design and Architecture

Running a Business

Sales / Marketing

Collaboration / Beta Testing

Work & Training Issues

○ ASP.NET

○ C / C++ / MFC >

ATL / WTL / STL

Managed C++/CLI○ C#

○ Database

○ Hardware & Devices >

System Admin

○ Hosting and Servers

○ Java

○ .NET Framework

○ Mobile

○ Sharepoint

○ Silverlight / WPF

○ Visual Basic

○ Web Development >

CSS

Javascript

PHP

○ Site Bugs / Suggestions

○ Other Languages>

General Indian Topics

General Chinese Topics

• Learning Zones○ The Commerce Zone

○ The Mobile Zone

○ The Cloud Zone

○ The Hardware Zone

○ The Parallelism Zone

○ The WPF / Silverlight Zone

○ The SQL Zone

○ WhitePapers / Webcasts

○ Solutions Center•

Features○ Who's Who

Page 3: Comparison Between C# and VB

8/6/2019 Comparison Between C# and VB

http://slidepdf.com/reader/full/comparison-between-c-and-vb 3/25

○ CodeProject MVPs

○ Company Listings

○ Component & Service Catalog

○ Competitions

○ News

○ Daily Insider

○ Newsletter archive

○ Press Releases

○ Surveys

○ CodeProject Stuff

○ CodeProject VS Addin• Help!

○ What is 'The Code Project'?

○ General FAQ

○ Post a Question

○ Bugs and Suggestions○ Site Directory

○ Advertise with us

○ About Us• The Lounge

○ The Lounge

○ Clever Code

○ Hall of Shame

○ The Soapbox

» Platforms, Frameworks & Libraries » .NET Framework » General

LicenceFirst Posted 30 Mar 2005Views 591,532Downloads 0Bookmarked 328 times

Complete Comparison for VB.NET and C#

By Amalorpavanathan Yagulasamy(AMAL) | 18 Apr 2005VS.NET2003 C# VBWindows .NET CEO Architect DBADev QA, +This article explains about advantages, differences and new features of VB.NET andC#. See Also

• More like this

• More by this author

160

Article Browse Code Stats Revisions

Page 4: Comparison Between C# and VB

8/6/2019 Comparison Between C# and VB

http://slidepdf.com/reader/full/comparison-between-c-and-vb 4/25

4.63 (132 votes)

Sponsored LinksParte superior do formulário

Contents1. Introduction

2. Advantages of both languages

3. Keyword Differences

4. Data types Differences

5. Operators Differences

6. Programming Difference

7. New Features of both languages in 2005 version

8. Conclusion

9. History

IntroductionSome people like VB.NET's natural language, case-insensitive approach, others likeC#'s terse syntax. But both have access to the same framework libraries. We willdiscuss about the differences in the following topics:

1. Advantages of both languages

2. Keyword Differences

3. Data types Differences

4. Operators Differences

5. Programming Difference

Advantages of both languages

VB.NET C#

• Support for optional parameters - veryhandy for some COM interoperability.

• Support for late binding with OptionStrict off - type safety at compile timegoes out of the window, but legacylibraries which don't have stronglytyped interfaces become easier to use.

• Support for named indexers.

• Various legacy VB functions (providedinthe Microsoft.VisualBasic namesp

ace, and can be used by otherlanguages with a reference to

• XML documentationgenerated from source code

comments. (This is coming inVB.NET with Whidbey (thecode name for the nextversion of Visual Studioand .NET), and there aretools which will do it withexisting VB.NET codealready.)

• Operator overloading - again,coming to VB.NET in

Whidbey.• Language support for

Page 5: Comparison Between C# and VB

8/6/2019 Comparison Between C# and VB

http://slidepdf.com/reader/full/comparison-between-c-and-vb 5/25

the Microsoft.VisualBasic.dll ). Many of these can be harmful to performance if used unwisely, however, and manypeople believe they should be avoidedfor the most part.

• The with construct: it's a matter of

debate as to whether this is anadvantage or not, but it's certainly adifference.

• Simpler (in expression - perhaps morecomplicated in understanding) eventhandling, where a method can declarethat it handles an event, rather thanthe handler having to be set up in

code.• The ability to implement interfaces with

methods of different names. (Arguablythis makes it harder to find theimplementation of an interface,however.)

• Catch ... When ... clauses, which allow

exceptions to be filtered based onruntime expressions rather than just bytype.

• The VB.NET parts of Visual Studio .NETcompiles your code in the background.While this is considered as anadvantage for small projects, peoplecreating very large projects have foundthat the IDE slows down considerablyas the project gets larger.

unsigned types (you can usethem from VB.NET, but theyaren't in the language itself).Again, support for these iscoming to VB.NET inWhidbey.

• The using statement, whichmakes unmanaged resourcedisposal simple.

• Explicit interfaceimplementation, where aninterface which is alreadyimplemented in a base classcan be re-implemented

separately in a derived class.Arguably this makes the classharder to understand, in thesame way that memberhiding normally does.

• Unsafe code. This allowspointer arithmetic etc, andcan improve performance insome situations. However, itis not to be used lightly, as a

lot of the normal safety of C#is lost (as the name implies).Note that unsafe code is stillmanaged code, i.e., it iscompiled to IL, JITted, andrun within the CLR.

Keyword Differences

Purpose VB.NET C#

Declare avariable

Private , Public , Friend , Protected ,Static1 , Shared , Dim

declarators (keywordsinclude user-defined typesand built-in types)

Declare anamedconstant

Const const

Create a

new object

New, CreateObject() new

Function/m Sub void

Page 6: Comparison Between C# and VB

8/6/2019 Comparison Between C# and VB

http://slidepdf.com/reader/full/comparison-between-c-and-vb 6/25

ethod doesnot returna value

Overload afunction ormethod(VisualBasic:overload aprocedureor method)

Overloads (No language keywordrequired for this purpose)

Refer tothe current

object

Me this

Make anonvirtualcall to avirtualmethod of the currentobject

MyClass n/a

Retrieve

characterfrom astring

GetChar Function []

Declare acompounddata type(VisualBasic:Structure)

Structure <members> End Structure struct , class , interface

Initialize anobject(constructors)

Sub New() Constructors, or systemdefault type constructors

Terminatean objectdirectly

n/a n/a

Methodcalled by

the system just before

Finalize destructor

Page 7: Comparison Between C# and VB

8/6/2019 Comparison Between C# and VB

http://slidepdf.com/reader/full/comparison-between-c-and-vb 7/25

garbagecollectionreclaims anobject7

Initialize avariablewhere it isdeclared

Collapse

Dim x As Long = 5

Collapse

Dim c As New _Car(FuelTypeEnum.Gas)

Collapse// initialize to avalue:

int x = 123 ;// or use default

// constructor:

int x = new int ();

Take theaddress of a function

AddressOf (For class members, thisoperator returns a reference to a function inthe form of a delegate instance)

delegate

Declarethat anobject canbe modifiedasynchronously

n/a volatile

Force

explicitdeclarationof variables

Option Explicit n/a. (All variables must be

declared prior to use)

Test for anobjectvariablethat doesnot refer toan object

obj = Nothing obj == null

Value of anobjectvariablethat doesnot refer toan object

Nothing null

Test for adatabasenullexpression

IsDbNull n/a

Test n/a n/a

Page 8: Comparison Between C# and VB

8/6/2019 Comparison Between C# and VB

http://slidepdf.com/reader/full/comparison-between-c-and-vb 8/25

whether aVariantvariablehas beeninitialized

Define adefaultproperty

Default by using indexers

Refer to abase class

MyBase base

Declare aninterface

Interface interface

Specify aninterface tobeimplemented

Implements (statement) class C1 : I1

Declare aclass

Class <implementation> class

Specifythat a classcan only beinherited.An instanceof the classcannot becreated.

MustInherit abstract

Specifythat a classcannot be

inherited

NotInheritable sealed

Declare anenumerated type

Enum <members> End Enum enum

Declare aclassconstant

Const const (Applied to a fielddeclaration)

Derive a

class froma base

Inherits C2 class C1 : C2

Page 9: Comparison Between C# and VB

8/6/2019 Comparison Between C# and VB

http://slidepdf.com/reader/full/comparison-between-c-and-vb 9/25

class

Override amethod

Overrides override

Declare amethodthat mustbeimplemented in aderivingclass

MustOverride abstract

Declare amethodthat can'tbeoverridden

NotOverridable (Methods arenot overridable by default.)

sealed

Declare avirtualmethod,property(VisualBasic), or

propertyaccessor(C#, C++)

Overridable virtual

Hide a baseclassmember ina derivedclass

Shadowing n/a

Declare a

typesafereferenceto a classmethod

Delegate delegate

Specifythat avariablecan containan objectwhoseevents youwish to

WithEvents (Write code - no specifickeyword)

Page 10: Comparison Between C# and VB

8/6/2019 Comparison Between C# and VB

http://slidepdf.com/reader/full/comparison-between-c-and-vb 10/25

handle

Specify theevents forwhich aneventprocedurewill becalled

Handles (Event procedures can still beassociated with a WithEvents variable bynaming pattern.)

n/a

Evaluate anobjectexpressiononce, inorder to

accessmultiplemembers

Collapse

With objExpr<.member><.member>

End With

n/a

Structuredexceptionhandling

Collapse

Try <attempt>Catch<handle errors>Finally<always execute>End Try

try , catch , finally , throw

Decisionstructure(selection)

Select Case ... , Case , Case Else , EndSelect

switch , case , default ,goto , break

Decisionstructure (if ... then)

If ... Then , ElseIf ... Then , Else , EndIf

if , else

Loopstructure(conditional

)

While, Do [ While , Until] ... , Loop [While, Until]

do , while , continue

Loopstructure(iteration)

For ... , [ Exit For ], NextFor Each ..., [ Exit For,] Next

for , foreach

Declare anarray

Collapse

Dim a() As Long

Collapse

int [] x = new int [ 5 ];

Initialize anarray

Collapse

Dim a() As Long = {3, 4, 5 }

Collapse

int [] x = new int [ 5 ] { 1 , 2 , 3 , 4 , 5 };

Reallocate Redim n/a

Page 11: Comparison Between C# and VB

8/6/2019 Comparison Between C# and VB

http://slidepdf.com/reader/full/comparison-between-c-and-vb 11/25

array

Visibleoutside theproject orassembly

Public public

Invisibleoutside theassembly(C#/VisualBasic) orwithin thepackage(Visual J#,

JScript)

Friend internal

Visible onlywithin theproject (fornestedclasses,within theenclosingclass)

Private private

Accessibleoutsideclass andproject ormodule

Public public

Accessibleoutside theclass, butwithin theproject

Friend internal

Onlyaccessiblewithin classor module

Private private

Onlyaccessibleto currentand derivedclasses

Protected protected

Preserve Static n/a

Page 12: Comparison Between C# and VB

8/6/2019 Comparison Between C# and VB

http://slidepdf.com/reader/full/comparison-between-c-and-vb 12/25

procedure'slocalvariables

Shared byallinstancesof a class

Shared static

Commentcode

'Rem

//, /* */ for multi-linecomments/// for XML comments

Case-sensitive?

No Yes

CallWindowsAPI

Declare <API> use Platform Invoke

Declareand raisean event

Event , RaiseEvent event

Threadingprimitives

SyncLock lock

Go to Goto goto

Data types Differences

Purpose/Size VB.NET C#

Decimal Decimal decimal

Date Date DateTime

(varies) String string

1 byte Byte byte

2 bytes Boolean bool

2 bytes Short , Char (Unicodecharacter)

short , char (Unicodecharacter)

4 bytes Integer int

8 bytes Long long

4 bytes Single float

8 bytes Double double

Page 13: Comparison Between C# and VB

8/6/2019 Comparison Between C# and VB

http://slidepdf.com/reader/full/comparison-between-c-and-vb 13/25

Operators Differences

Purpose VB.NET C#

Integer division \ /

Modulus (divisionreturning only theremainder)

Mod %

Exponentiation ^ n/a

Integer divisionAssignment

\= /=

Concatenate &= NEW +=

Modulus n/a %=

Bitwise-AND n/a &=

Bitwise-exclusive-OR n/a ^=

Bitwise-inclusive-OR n/a |=

Equal = ==

Not equal <> !=

Compare two objectreference variables

Is ==

Compare objectreference type

TypeOf x Is Class1 x is Class1

Concatenate strings & +

Shortcircuited Boolean

AND

AndAlso &&

Shortcircuited BooleanOR

OrElse ||

Scope resolution . . and base

Array element () [ ]

Type cast Cint , CDbl , ..., CType (type)

Postfix increment n/a ++

Postfix decrement n/a --

Page 14: Comparison Between C# and VB

8/6/2019 Comparison Between C# and VB

http://slidepdf.com/reader/full/comparison-between-c-and-vb 14/25

Indirection n/a * (unsafe mode only)

Address of AddressOf & (unsafe mode only; also see

fixed)

Logical-NOT Not !

One's complement Not ~

Prefix increment n/a ++

Prefix decrement n/a --

Size of type n/a sizeof

Bitwise-AND And &

Bitwise-exclusive-OR Xor ^

Bitwise-inclusive-OR Or |

Logical-AND And &&

Logical-OR Or ||

Conditional If Function () ?:

Pointer to member n/a . (Unsafe mode only)

Programming Difference

Purpose VB.NET C#

DeclaringVariables

Collapse

Dim x As IntegerPublic x As Integer = 10

Collapse

int x;int x = 10 ;

Comments Collapse

' comment

x = 1 ' comment

Rem comment

Collapse

// comment

/* multilinecomment */

AssignmentStatements

Collapse

nVal = 7

Collapse

nVal = 7;

ConditionalStatements

Collapse

If nCnt <= nMax Then ' Same as nTotal =

' nTotal + nCnt.

Collapse

if (nCnt <= nMax){

nTotal += nCnt;nCnt++;

}

Page 15: Comparison Between C# and VB

8/6/2019 Comparison Between C# and VB

http://slidepdf.com/reader/full/comparison-between-c-and-vb 15/25

nTotal += nCnt' Same as nCnt = nCnt + 1.

nCnt += 1 Else

nTotal += nCntnCnt -= 1

End If

else{

nTotal +=nCnt;nCnt--;

}

SelectionStatements

Collapse

Select Case n Case 0

MsgBox ( "Zero" )' Visual Basic .NET exits

' the Select at

' the end of a Case.

Case 1

MsgBox ( "One" ) Case 2

MsgBox ( "Two" ) Case Else

MsgBox ( "Default" )End Select

Collapse

switch (n){ case 0 :

Console.WriteLine( "Zero" ); break ; case 1 :

Console.WriteLine( "One" ); break ;

case 2 :Console.WriteLine( "Two

" ); break ; default :

Console.WriteLine( "?" ); break ;}

FOR Loops Collapse

For n = 1 To 10 MsgBox( "The number is " & n)

Next

For Each prop In objprop = 42

Next prop

Collapse

for ( int i = 1 ; i <= 10 ; i++)

Console.WriteLine( "The number is {0}" ,i);foreach (prop current in obj){

current=42;}

Hiding BaseClassMembers

Collapse

Public Class BaseCls ' The element to be shadowed

Public Z As Integer = 100

public Sub Test()System.Console.WriteLine( _ "Test in BaseCls" ) End SubEnd Class

Public Class DervCls Inherits BaseCls ' The shadowing element.

Public Shadows Z As String ="*" public Shadows Sub Test()

System.Console.WriteLine( _ "Test in DervCls" ) End SubEnd Class

Collapse

public class BaseCls{ // The element to behidden

public int Z = 100 ;public void Test(){

System.Console.WriteLine( "Test in BaseCls" );

}}

public class DervCls :BaseCls{ // The hiding element

public new string Z = "*" ;public new void Test()

Page 16: Comparison Between C# and VB

8/6/2019 Comparison Between C# and VB

http://slidepdf.com/reader/full/comparison-between-c-and-vb 16/25

Public Class UseClasses ' DervCls widens to BaseCls.

Dim BObj As BaseCls =New DervCls()

' Access through derived

' class.

Dim DObj As DervCls =New DervCls()

Public Sub ShowZ()System.Console.WriteLine( _

"Accessed through base " &_ "class: " & BObj.Z)

System.Console.WriteLine(_ "Accessed through derived " &_ "class: " & DObj.Z)

BObj.Test()

DObj.Test() End Sub End Class

{System.Console.WriteLine

( "Test in DervCls" );

}}

public class UseClasses{ // DervCls widens toBaseCls

BaseCls BObj = newDervCls();

// Access through derived

//class

DervCls DObj = newDervCls();

public void ShowZ()

{System.Console.WriteLine

( "Accessed through " + "base class: {0}" ,

BObj.Z);System.Console.WriteLine

( "Accessed through" + " derived class:{0}" ,

DObj.Z);BObj.Test();DObj.Test();

}}

WHILELoops

Collapse' Test at start of loop

While n < 100 . ' Same as n = n + 1.

n += 1 End While '

Collapse

while (n < 100 )n++;

Parameter

Passing byValue

Collapse

' The argument Y is

'passed by value.

Public Sub ABC( _ ByVal y As Long )'If ABC changes y, the

' changes do not affect x.

End Sub ABC(x) ' Call the procedure.

' You can force parameters to

' be passed by value,

Collapse

/* Note that there isno way to pass referencetypes (objects) strictly by value. You can chooseto either pass the reference(essentially a pointer), or a reference to the reference(a pointer to a pointer).*/ // The method:

void ABC( int x){

...}// Calling the method:

ABC(i);

Page 17: Comparison Between C# and VB

8/6/2019 Comparison Between C# and VB

http://slidepdf.com/reader/full/comparison-between-c-and-vb 17/25

' regardless of how

' they are declared,

' by enclosing

' the parameters in

' extra parentheses.

ABC((x))

ParameterPassing byReference

Collapse

Public Sub ABC( ByRef y As Long )' The parameter y is declared

'by referece:

' If ABC changes y, the changesare

' made to the value of x.

End Sub

ABC(x) ' Call the procedure.

Collapse/* Note that there is no

way to pass reference types(objects) strictly by

value.You can choose to either

pass the reference(essentially a pointer),or a reference to thereference (a pointer to a

pointer).*/ // Note also that unsafe C#

//methods can take pointers

//just like C++ methods. For

//details, see unsafe.

// The method:

void ABC( ref int x){

...}// Calling the method:

ABC(ref i);

StructuredExceptionHandling

Collapse

Try If x = 0 Then Throw New Exception( _ "x equals zero" ) Else Throw New Exception( _ "x does not equal zero" ) End IfCatch err As System.Exception

MsgBox( _ "Error: " & Err.Description)Finally

MsgBox( _ "Executing finally block." )End Try

Collapse// try-catch-finally

try{ if (x == 0 ) throw newSystem.Exception( "x equals zero" ); else throw newSystem.Exception( "x does not equalzero" );}catch (System.Exception err){

System.Console.WriteLine(err.Message);

Page 18: Comparison Between C# and VB

8/6/2019 Comparison Between C# and VB

http://slidepdf.com/reader/full/comparison-between-c-and-vb 18/25

}finally{

System.Console.WriteLine( "executing finallyblock" );}

Set anObjectReferenceto Nothing

Collapse

o = Nothing

Collapse

o = null ;

InitializingValue

Types

Collapse

Dim dt as New System.DateTime( _

2001, 4, 12, 22, 16, 49, 844 )

Collapse

System.DateTime dt =

new System.DateTime( 2001 , 4 , 12 , 22 , 16 ,49 , 844 );

New Features of both languages in 2005 version

VB.NET C#

Visual Basic 2005 has many new andimproved language features -- such asinheritance, interfaces, overriding,shared members, and overloading --

that make it a powerful object-orientedprogramming language. As a VisualBasic developer, you can now createmultithreaded, scalable applicationsusing explicit multithreading. Thislanguage has following new features,

1. Continue Statement, which

immediately skips to the nextiteration of a Do, For ,or While loop.

2. IsNot operator, which you canavoid usingthe Not and Is operators in anawkward order.

3. 3. Using ... End . Using statem

ent block ensures disposal of asystem resource when yourcode leaves the block for anyreason.

Collapse

With the release of Visual Studio 2005, theC# language has been updated to version2.0. This language has following newfeatures:

1. Generics types are added to thelanguage to enable programmers toachieve a high level of code reuseand enhanced performance forcollection classes. Generic types candiffer only by arity. Parameters canalso be forced to be specific types.

2. Iterators make it easier to dictatehow a for each loop will iterate overa collection's contents.

Collapse// Iterator Example

public class NumChar{string [] saNum = {

"One" , "Two" , "Three" ,"Four" , "Five" , "Six" ,"Seven" , "Eight" , "Nine" ,"Zero" };

public System.Collections.IEnumerator

GetEnumerator(){

Page 19: Comparison Between C# and VB

8/6/2019 Comparison Between C# and VB

http://slidepdf.com/reader/full/comparison-between-c-and-vb 19/25

Public Sub setbigbold( _ ByVal c As Control)Using nf As New _

System.Drawing.Font( "Arial" ,_ 12 .0F, FontStyle.Bold)

c.Font = nfc.Text = "This is" &_

"12-point Arial bold"End UsingEnd Sub

4. Explicit Zero Lower Bound onan Array , Visual Basic nowpermits an array declaration tospecify the lower bound (0) of each dimension along with theupper bound.

5. Unsigned Types , Visual Basicnow supports unsigned integerdata types ( UShort , UInteger ,and ULong ) as well as thesigned type SByte .

6. Operator Overloading , VisualBasic now allows you to define astandard operator (suchas +, &, Not , or Mod) on a class

or structure you have defined.

7. Partial Types , to separategenerated code from yourauthored code into separatesource files.

8. Visual Basic now supports typeparameters on generic classes,structures, interfaces,procedures, and delegates. Acorresponding type argument

specifies at compilation time thedata type of one of the elementsin the generic type.

9. Custom Events . You candeclare custom events by usingthe Custom keyword as amodifier forthe Event statement. In acustom event, you specifyexactly what happens when

code adds or removes an eventhandler to or from the event, or

foreach ( string num in saNum)yield return num;}}// Create an instance of

// the collection class

NumChar oNumChar = newNumChar();// Iterate through it withforeach

foreach ( string num in oNumChar)Console.WriteLine(num);

3. Partial type definitions allow asingle type, such as a class, to besplit into multiple files. The Visual

Studio designer uses this feature toseparate its generated code fromuser code.

4. Nullable types allow a variable to

contain a value that is undefined.

5. Anonymous Method is now possibleto pass a block of code as aparameter. Anywhere a delegate isexpected, a code block can be usedinstead: There is no need to define a

new method.

Collapse

button1.Click +=delegate { MessageBox.Show("Click!" ) };

6. . The namespace aliasqualifier ( :: ) provides more controlover accessing namespacemembers. The global :: alias allows

to access the root namespace thatmay be hidden by an entity in yourcode.

7. Static classes are a safe andconvenient way of declaring a classcontaining static methods thatcannot be instantiated. In C# v1.2you would have defined the classconstructor as private to prevent theclass being instantiated.

8. 8. There are eight new compileroptions :

Page 20: Comparison Between C# and VB

8/6/2019 Comparison Between C# and VB

http://slidepdf.com/reader/full/comparison-between-c-and-vb 20/25

when code raises the event.

10. Compiler Checking Options ,The /nowarn and /warnaserroroptions provide more control

over how warnings are handled.Each one of these compileroptions now takes a list of warning IDs as an optionalparameter, to specify to whichwarnings the option applies.

11. There are eight new command-line compiler options:

a. The /codepage optionspecifies which codepageto use when openingsource files.

b. The /doc optiongenerates an XMLdocumentation file basedon comments within yourcode.

c. The /errorreport optionprovides a convenient

way to report a VisualBasic internal compilererror to Microsoft.

d. The /filealign optionspecifies the size of sections in your outputfile.

e. The /noconfig optioncauses the compiler toignore the Vbc.rsp file.

f. The /nostdlib optionprevents the importof mscorlib.dll , whichdefines the entire Systemnamespace.

g. The /platform optionspecifies the processor tobe targeted by theoutput file, in thosesituations where it isnecessary to explicitly

a. /langversion option: Can beused to specify compatibilitywith a specific version of thelanguage.

b. /platform option: Enablesyou to target IPF (IA64 orItanium) and AMD64architectures.

c. #pragma warning: Used todisable and enable individualwarnings in code.

d. /linkresource option:Contains additional options.

e. /errorreport option: Can beused to report internalcompiler errors to Microsoftover the Internet.

f. /keycontainer and /keyfile : Support specifyingcryptographic keys.

Page 21: Comparison Between C# and VB

8/6/2019 Comparison Between C# and VB

http://slidepdf.com/reader/full/comparison-between-c-and-vb 21/25

specify it.

h. The /unify optionsuppresses warningsresulting from a

mismatch between theversions of directly andindirectly referencedassemblies.

ConclusionI think that this article will help you understand both language features and alsoyou can choose a language based on your taste. I will update this article in future if there are any changes.

History• 14 Apr 2005 - Topic added - "New features of both languages in 2005

version"

• 30 Mar 2005 - Initial version.

LicenseThis article has no explicit license attached to it but may contain usage terms in thearticle text or the download files themselves. If in doubt please contact the authorvia the discussion board below.

A list of licenses authors might use can be found here

About the AuthorAmalorpavanathanYagulasamy(AMAL)

Web Developer

United States

Member

Amalorpavanathan Yagulasamy (AMAL) is a SoftwareEngineer for Protech Solution Inc. and has designed andimplemented projects for Arkansas Child Support, ArkansasBudgetting, Michigan Child Support , Massachusetts ChildSupport, National Informatics Center-India and Indian OilCorporation. His background is in developing relationaldatabases and n-tier applications on Windows platforms inCMM Level Standards. He can be reached [email protected]

Article Top

Sign Up to vote for this articleParte inferior do formulário

Page 22: Comparison Between C# and VB

8/6/2019 Comparison Between C# and VB

http://slidepdf.com/reader/full/comparison-between-c-and-vb 22/25

Comments and Discussions

You must Sign In to use this message board. ( secure sign-in )

FAQ

Parte superior do for

Parte inferior do formParte superior do formulário

Noise Tolerance

Medium

Layout

Norm

Parte inferior do formulário

Msgs 1 to 25 of 160 (Total in Forum: 160) ( Refresh )

My vote of 1 DaveCS

My vote of 1 ely_bob

default(T) PIEBALDconsult

My vote of 1 chejarla balu

My vote of 5 rajan_top1

Very Good Ant2100

Nice Man Jinal Desai - LIVE

This is an OLD article Updated: 18 Apr 2005 DH

Re: This is an OLD article Updated: 18 Apr 2005

Re: This is an OLD article Updated: 18 Apr 2005 Pau

My vote of 1 DHCut

Re: My vote of 1 Simon_Whale

VB has XML comments also! The.Infog

Logical and / or wrong in current version of the overview

Legacy VB functions is BAD! cockiest

Page 23: Comparison Between C# and VB

8/6/2019 Comparison Between C# and VB

http://slidepdf.com/reader/full/comparison-between-c-and-vb 23/25

Not If but IIF alopexq

Re: Not If but IIF Kim Moung Soo

Re: Not If but IIF naughton

VB.NET background compiler performance hit?

missed several key differences LongRange

how to use "isNot Nothing" in c#? fofoth

Re: how to use "isNot Nothing" in c#? [modified] Ey

Re: how to use "isNot Nothing" in c#? fofot

Anonymous Method alhambra-eidos

Regarding this topic. Anthony_Yio

Last Visit: 19:00 31 Dec '99 Last Update: 20:25 28 Apr '11

General News Question Answer Joke Rant Admin

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads,Ctrl+PgUp/PgDown to switch pages.

link | Privacy | Terms of Use | Mobile

Last Updated: 18 Apr 2005

Copyright 2005 by Amalorpavanathan Yagulasamy(AMAL)

Everything else Copyright © CodeProject , 1999-2011

Web02 | Advertise on the Code ProjectData Dynamics Reports for Windows Forms, ASP.NET

Data Dynamics Reports for Business Reporting...

www.gcpowertools.com

Get 6 Months Free ASP.NET 4.0 Hosting!

DiscountASP.NET is a Microsoft Windows-based...

www.discountasp.net

Resco MobileForms Toolkit

The richest, most complete and award winning...

www.resco.net

See Also...

Page 24: Comparison Between C# and VB

8/6/2019 Comparison Between C# and VB

http://slidepdf.com/reader/full/comparison-between-c-and-vb 24/25

GBVB - Converting VB.NET code to C#

A tool and a method for VB.NET to C# source...

Step by Step: Event handling in VB.NET

Step by step guide to implement event handling...

Cheat Sheet - Casting in VB.NET and C#Describes several casting and type related...

Object Oriented Programming In VB.NET

A must read for anyone who is interested in...

Abstract Class versus Interface

Abstract class versus Interface: Usage and...

The Daily Insider30 free programming books

Daily News: Signup now .