Languages in the .NET Framework

On Day 1, “Introduction to the Microsoft .NET Framework,” the core message was that as a developer, you have access to a unified set of classes. The classes in the framework class library (FCL) are what you access in your applications to provide various functionalities, such as reading and writing of files, accessing a database, or creating a user interface. No matter the language, the classes in the FCL are available to any language that runs inside the .NET Framework runtime.

Before .NET, programming languages lived inside their own box. Visual Basic had the VBRUN DLLs that provided its runtime, and C++ had its own runtime to make C++ programs work. This caused problems when an application written in one language wanted to talk to an application written in a different language. Data types were different, the way objects were handled was different, and there was a lot of overhead for the system to work between applications just to accomplish simple tasks.

With the advent of .NET, these issues are no longer relevant. Because the .NET Framework exposes a unified set of classes, each .NET language has access to the services offered by those classes in a consistent manner. The way you access data in SQL Server in Visual Basic .NET is the same way you would do it C#, COBOL .NET, Perl .NET, and so on. All the class libraries are accessible by any language. Because of this, understanding how the different languages work is merely an issue of syntax, not functionality.

Today you're going to see the differences between Visual Basic .NET syntax and C# syntax. By the end of the day, you'll probably be scratching your head wondering why there are separate Visual Basic .NET and C# languages, and not just one language. To answer that question, you can look at how long it might have taken you to become familiar with the languages you write in now. If you're coming from a C, C++, or Java background, the syntax and the functionality are different from Visual Basic 6. The goal in having multiple languages in .NET is to get all developers up to speed quickly in the language syntax they prefer. The difference with .NET is that all languages share the same functionality. One language doesn't run any faster than another language. It's much easier to move from Visual Basic 6 to Visual Basic .NET than from Visual Basic 6 to C#. That's why so many languages are supported by the .NET Framework.

Note

The argument of C# running faster then Visual Basic .NET has been raging since the languages were introduced. Remember that all .NET languages must compile to the Microsoft Intermediate Language (MSIL), and the .NET runtime converts the MSIL to the processor-specific code that actually runs your applications. So, although the MSIL code might not be identical among different languages, the speed at which it runs is the same. There's no “better” language to code in—they're all essentially the same. At the other end of that spectrum, if I create my own .NET language, perhaps Jason#, and my compiler doesn't produce very efficient MSIL, my language might perform worse than others. But in general, the MSIL produced by the language-specific compilers is highly efficient.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.195.29