With the release of VS2008 and .NET Fx 3.5, there were lot of new language enhancements and features extensions to framework, like LINQ, Extension methods, Lambda expressions, Expression trees, Auto-Implemented properties, Object and Collection initializer. However, some of these features were not common to C# and VB. Like Auto-Implemented Properties were not there in VB, but were available only in C#. You can find my blog-post Language Enhancements in C# 3.0 and VB9, which I had written, when VS2008 was released.
With the advent of Visual Studio 2010, .NET Framework 4.0, now these languages will compliment each other. Almost all language features are now common to these languages. Let’s visit some of these new features.
- Implicit Line Continuation [In VB only]:
In VB, each statement ends at the end of line. However, in previous versions of VB, if developers wanted to part the code in multiple lines, they had to use (_) character. Following code snippet will show you this. But, with this release of VB.NET, now developers can write code in multiple lines, without requiring any special character. The code can be written easily as:
However, there are some rules. Developers can’t just start a new line from anywhere in between the code. The next line can be started:
After a comma, after open parenthesis like “(“ or before closing parenthesis “)”.
You can find more information about this here on MSDN - Auto-Implemented Property [In VB, Was there in C#]:
As MSDN says: Auto-implemented properties enable you to quickly specify a property of a class without having to write code to Get and Set the property. So, that means, now I don’t need to create a private variable don’t need to write getter and setter to ‘encapsulate’ it.
Visual Basic compiler will automatically create this private variable for you. So, you can create a Auto-Implemented property by writing:
So, one may ask, what will be the name of this private variable and can I access it? Well, the private variable, also called as ‘backing field’, will have same name as that of property, with underscore (_) prefixed. This field can be accessed in code and in debug window, but will not be available in IntelliSense.
For more information, visit: MSDN - Collection Initializer [In VB.NET, Was there in C#]:
In C# 3.0, we had collection initializer. It is nothing but a shor-cut to create and initialize the collection. So, if I use VS1010 with new features in VB.NET, now I can write it like:
And this will create a one dimensional array of strings. So, this is just one another shortest method to create and initialize arrays and collections.
You can find other useful information here at MSDN
Till then, enjoy coding.
This blog gives very important info about .Net Thanks for sharing
.Net Online Course Hyderabad
Thanks for sharing such informative guide on .Net technology. This post gives me detailed information about the .net technology. I am working as trainer in leading IT training academy offering Dot Net Training in Chennai
ReplyDeleteDot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery
Tül Perde Modelleri
ReplyDeletesms onay
mobil ödeme bozdurma
nft nasıl alınır
ANKARA EVDEN EVE NAKLİYAT
TRAFİK SİGORTASİ
DEDEKTÖR
web sitesi kurma
ask romanlari
Smm Panel
ReplyDeletesmm panel
iş ilanları
instagram takipçi satın al
Hırdavatçı Burada
HTTPS://WWW.BEYAZESYATEKNİKSERVİSİ.COM.TR
servis
Jeton Hilesi
Elevate your online presence with powerful dedicated servers Chicago. Experience unmatched performance and reliability for your business needs.
ReplyDeleteEscape to a luxurious resort in jaipur, where royal elegance meets modern comfort. Enjoy world-class amenities, serene landscapes, and unforgettable experiences.
ReplyDelete