Wriju's BLOG

.NET, Cloud and everything

VB.NET 10 : PLINQ

LINQ can be more faster with the availability of multi-core desktops. This can be implemented with minimal impact at the code level with existing code. Here how it looks like, Dim arrInt = Enumerable.Range(1, 4000000) Dim q =     From n In arrant     Where (IsPrime(n))     Select n In my dual core machine it… Read more

VB.NET 10 : Working with Array

Working with Array in VB.NET 2010 (VS 2010) is real fun. You can leave it to the compiler to decide. Be it one dimensional array, two dimensional array or jagged array.. One-dimensional Array When you declare something Dim arr() As Integer = New Integer() {1, 2, 3, 4} You explicitly mention the type so on…. Read more

VB.NET 10 : Optional Nullable Parameter

If you want to assign Nothing to the optional parameter in VB.NET 10, it is just like to obvious now, Sub Main()     ‘Passing value for the optional parament _age     MyFunc(“Wriju”, “wriju@contoso.com”, 30)       ‘No value is supplied for the optional parament _age     MyFunc(“Writam”, “writam@contoso.com”) End Sub     Sub MyFunc(ByVal _name… Read more

VB.NET 10 : Multiline Lambdas

With implicit line continuation VB.NET 10 now allows you to write the multiline Lambdas. That means like your normal Functions you can write functions under Lambdas. So now you may write like, Dim arrInt As Integer() = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}   Dim myFinc = Array.FindAll(arrInt, Function(n)                                        If… Read more

VB.NET 10 : Nullable Optional Parameter

You can create method with optional parameter and also make them Nullable. Optional with default value Sub Test(ByVal _name As String, ByVal _email As String, Optional ByVal _age As Integer = 30)   Optional and Nullable Sub Test(ByVal _name As String, ByVal _email As String, Optional ByVal _age As Integer? = Nothing) Similarly you also… Read more

VB.NET 10 : Collection Initializer

Another useful feature which was missing in VB.Net 9 is available in Visual Studio 2010. This provides option to declare and initialize with series of values with the keyword Form. Dim myList As New List(Of Integer) From {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}   For Each i In myList     Console.WriteLine(i)… Read more

Visual Basic 10 : Line Continuation Magic

There are some new enhancements in Visual Basic 2010 or Visual Basic 10 where you can really have greater flexibility on how you handle multiple lines for continuous statements,   ‘Explicit Continious Line (no need to use & _ ) Dim sContinuation As String =     “Hey you know I can write multiple lines without… Read more