Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Kaushal Gajjar

Kaushal Gajjar Kaushal Gajjar Kaushal

Niner since 2009

  • LINQ Language Deep Dive with Visual Studio 2008

    I am wondering what would be the correct way of giving a specific datatype to IQuariable of Anynomous using  "WITH". For example:

     

     Dim Contacts = From C In PracticeDB.Contacts _ 
    Select New With {.ID = C.ID, .Name = C.Name}

     

     Dim Query = New With {.ID = 1, .Name = "Kaushal"}

     

    In above both query it has "ID" and "Name" property of anonymous type.

     

    In above, How to specify "ID" property as Decimal? While selecting the statement from DataContext ID appears as Decimal because the type specified is "Numeric" in SQL Database.

     

    So far I found a way by parsing data type to integer in first query as following:

     

    Dim Contacts = From C In PracticeDB.Contacts _ 
    Select New With {.ID = Integer.Parse(C.ID), .Name = C.Name}

     

     Dim Query = New With {.ID = 1, .Name = "Kaushal"}

     

    I am wondering if there is any way to specify within WITH Statement.

     

     

  • LINQ Language Deep Dive with Visual Studio 2008

    Great overview! 

     

    Learning from this video is much easier then browsing msdn documents.