Visual Studio .NET All-in-One Cheat Sheet - dummies
Cheat Sheet

Visual Studio .NET All-in-One Cheat Sheet

From Visual Studio.NET All-in-One Desk Reference For Dummies

By Nitin Pandey, Yesh Singhal, Mridula Parihar

Visual Studio .NET provides a complete development environment in which you can create a variety of applications ranging from Windows applications to ASP.NET Web applications and Web services. Explore Visual Studio .NET by looking at new features in Visual Basic .NET and Visual C# .NET, and then wet your whistle with some of the language changes in Visual Basic .NET.

New Features in Visual Basic .NET

Visual Basic .NET, part of the Visual Studio .NET suite, boasts a number of new features designed to make programming faster and easier. In addition to the basic features, such as variables, data types, constants, arrays, enumerations, operators, expressions, statements, and procedures, some of the new features of Visual Basic are

  • Assemblies: An EXE or a DLL file that forms the basis of deployment, version control, reuse, and security permissions of an application.

  • Namespaces: The components of assemblies, namespaces primarily organize the objects present in the assemblies. An assembly can contain more than one namespace.

  • Adding references: You need to add a reference to the external object that you want to use in your current application.

  • Attributes: The tags that are used to provide additional information about the elements defined in a Visual Basic .NET program. Some of the most common uses of attributes are

    • To explain COM properties for classes, interfaces, and methods

    • To explain assemblies

    • To specify security requirements of methods

    • To specify features required to enforce security

  • Inheritance: Enables you to create classes that are derived from some other classes known as base classes. Inheritance provides you the advantage of defining a class only once. You can then reuse this functionality by deriving new classes from this class.

  • Windows Forms: With a new forms package called Windows Forms, Visual Basic .NET allows the developers to inherit a form from an existing form.

  • Structured exception handling: Enables you to create more efficient and robust error handlers by using structured exception handling, which allows you to detect and remove errors at runtime.

  • Multithreading: Enables your applications to handle multiple tasks simultaneously.

New Features in Visual C# .NET

Visual C# .NET (pronounced Visual C sharp) is Microsoft’s new-generation programming language that integrates the flexibility of C++ with the short development cycle of Visual Basic. These features, along with an array of new features, make Visual C# more than just the sum of Visual Basic and C++.

Some of the features of Visual C# are

  • Garbage collection: The function of the garbage collector, provided by Visual C#, is to check for the objects not being used by an application and to delete them from memory.

  • Value/reference type system: According to the value/reference type system, the standard data types, enumerations, and structures are called value types. Interfaces, classes, and delegates are called reference types. This type system provides the advantage of eliminating a number of memory bugs and simplifying object manipulation.

  • Unified declaration and definition of class methods: The unified declaration and definition of class methods alleviates you from creating multiple files — one for declaration and the other for definition.

  • Delegates: A type-safe and secure object that contains a reference to a method. The advantage of using delegates is that it is helpful in anonymous invocation, which means that the method to be invoked is not known at compile time.

  • Simple thread synchronization: Enables you to create multithreaded applications.

  • Versioning: You need to explicitly override the members of a base class in a derived class. This revision creates a new version without affecting the existing program.

  • Interoperability: Visual C# applications are platform-independent.

  • Access to native-code: Visual C# allows a developer to programmatically view the native code.

  • Attributes: A declarative tag that you can use to describe various entities in your programs.

Language Changes in Visual Basic .NET

Visual Basic .NET (part of the Visual Studio .NET suite) incorporates a number of language changes for database programmers — whether you are experienced or a beginner. Here’s a quick look at some of the changes:

  • Variable declaration changes: In Visual Basic .NET, you can declare multiple variables in a single line without specifying the type of each variable.

  • Array changes:

    • By default, the lower bound of an array is 0, which can’t be modified.

    • You can’t create fixed-sized arrays in Visual Basic .NET.

    • You can’t use the ReDim statement for declaring arrays for the first time. You can use this statement only for resizing an array.

  • Data type changes:

    • Visual Basic .NET doesn’t support the Currency data type. Instead, the Decimal data type can be used to store currency values.

    • In Visual Basic 6.0, a date was stored in the Double data type. However, Visual Basic .NET provides the DateTime data type to store the values in the date format.

    • In Visual Basic 6.0, the Variant data type is used to store data of any type. In Visual Basic .NET, the Object data type is used to store data of any type.

  • Logical operator changes: In Visual Basic 6.0 you use And, Or, Not, and Xor to perform the logical and bitwise operations. In Visual Basic .NET, however, And, Or, Not, and Xor can perform only logical operations. To perform bitwise operations, you use BitAnd, BitOr, BitNot, and BitXor operators.