• +91 9723535972
  • info@interviewmaterial.com

DotNet Interview Questions and Answers

Question - What is the difference between VB and VB.NET?

Answer - Now VB.NET is object-oriented language. The following are some of the differences: Data Type Changes The .NET platform provides Common Type System to all the supported languages. This means that all the languages must support the same data types as enforced by common language runtime. This eliminates data type incompatibilities between various languages. For example on the 32-bit Windows platform, the integer data type takes 4 bytes in languages like C++ whereas in VB it takes 2 bytes. Following are the main changes related to data types in VB.NET: . Under .NET the integer data type in VB.NET is also 4 bytes in size. . VB.NET has no currency data type. Instead it provides decimal as a replacement. . VB.NET introduces a new data type called Char. The char data type takes 2 bytes and can store Unicode characters. . VB.NET do not have Variant data type. To achieve a result similar to variant type you can use Object data type. (Since every thing in .NET including primitive data types is an object, a variable of object type can point to any data type). . In VB.NET there is no concept of fixed length strings. . In VB6 we used the Type keyword to declare our user-defined structures. VB.NET introduces the structure keyword for the same purpose. Declaring Variables Consider this simple example in VB6: Dim x,y as integer In this example VB6 will consider x as variant and y as integer, which is somewhat odd behavior. VB.NET corrects this problem, creating both x and y as integers. Furthermore, VB.NET allows you to assign initial values to the variables in the declaration statement itself: br> Dim str1 as string = Hello VB.NET also introduces Read-Only variables. Unlike constants Read-Only variables can be declared without initialization but once you assign a value to it, it cannot be changes. Initialization here Dim readonly x as integer In later code X=100 Now x can’t be changed X=200 *********** Error ********** Property Syntax In VB.NET, we anymore don't have separate declarations for Get and Set/Let. Now, everything is done in a single property declaration. This can be better explained by the following example. Public [ReadOnly | WriteOnly] P

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners