VB/C# Code Converter

VB/C# Code Converter

VB/C# Code Converter

VB/C# .Net Code Converter is a free and simple VB to C# and C# to VB code converter. This online tool allows you to convert entire class code or selected section of code snippets.

Bookmark:

VB/C# Code Converter

This online code conversion tool powered by open source NRefactory library. NRefactory is a powerful C# to VB and VB to C# conversion engine maintained by the developers at SharpDevelop. By default, NRefactory may requires that all code be properly wrapped in a class and (as necessary) method before converting.

 Code 


Image Verification

Features of Visual Basic .NET not found in C#

  • Variables can be declared using the WithEvents construct. This construct is available so that a programmer may select an object from the Class Name drop down list and then select a method from the Declarations drop down list to have the Method signature automatically inserted
  • Auto-wireup of events, VB.NET has the Handles syntax for events
  • Marshalling an object for multiple actions using an unqualified dot reference. This is done using the With ... End With structure
  • IsNumeric evaluates whether a string can be cast into a numeric value (the equivalent for C# requires using int.TryParse)
  • XML Literals
  • Inline date declarations by using #1/1/2000# syntax (M/dd/yyyy).
  • Module (although C#'s sealed static classes with additional semantics, but each field has to individually be declared as static)
  • Members of Modules imported to the current file, can be access with no preceeding container accessor (See Now for example)
  • The My namespace
  • Visual Studio's design-time experience is more responsive in the VB.NET language
  • COM components and interoperability is more powerful in VB.NET as the Object type is bound at runtime
  • Namespaces can be important in project level, so they don't have to be imported to each individual file, like C#
  • Root namespace, in VB.NET projets, you can set the assembly root namespace which the whole project is wrapped with it, and you don't have to declare the namespace for each container.

Features of C# not found in Visual Basic .NET

  • Allows blocks of unsafe code (like C++/CLI) via the unsafe keyword.
  • Partial Interfaces
  • Iterators and the yield keyword
  • Multi-line comments (note that the Visual Studio IDE supports multi-line commenting for Visual Basic .NET)
  • Static classes (Classes which cannot contain any non-static members, although VB's Modules are essentially sealed static classes with additional semantics)
  • Can use checked and unchecked contexts for fine-grained control of overflow/underflow checking

Other characteristics of Visual Basic .NET not applicable to C#

  • Conversion of Boolean value True to Integer may yield -1 or 1 depending on the conversion used
  • Assigning and comparing variables uses the same token, =. Whereas C# has separate tokens, == for comparison and = to assign a value
  • VB.NET is not case-sensitive.
  • Type checking is less strict by default. If the default is left in place, It will auto convert type without notifying programmer
  • Val() function which also parses a null value while converting into double (In c# Convert.ToDouble() is used to convert any object into double type value, but which throws exception in case of a null value)
  • CInt, CStr, CByte and a wide variety of converting functions built in the language

Other characteristics of C# not applicable to Visual Basic .NET

  • By default, numeric operations are not checked. This results in slightly faster code, at the risk that numeric overflows will not be detected. However, the programmer can place arithmetic operations into a checked context to activate overflow checking. (It can be done in Visual Basic by checking an option)
  • Addition and string concatenation use the same token, +. Visual Basic .NET, however, has separate tokens, + for addition and & for concatenation, although + can be used for concatenation as well.
  • In Visual Basic .NET property methods may take parameters
  • C# is case-sensitive.

External Resources: