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

DashNY

DashNY DashNY

Niner since 2005

  • Introducing the Class Designer

    Maurits wrote:
    Very cool!

    I noticed that Fields are private-by-default, and Methods are public-by-default.

    I have to question that... I frequently find myself developing private "helper methods", and it seems that methods should be private by default as a security/encapsulation feature.



    I strongly disagree. When designing a new class, one should first think of all the public actions it can perform. Once the "public" functionality of a class is finalized, one can jump into the code view and write the definitions of those methods, adding private (helper) methods when neccessary.
  • Anders Hejlsberg - LINQ

    Azura wrote:
    How does one construct a dynamic where clause in LINQ?
    ... Select clause?

    For instance, If we intend to build a screen that allows the user search and display customers using customers' Name, Phone #, City,  and etc...

    Today, a constructed SQL will look apporx like this:

    string sqlStmt = "SELECT * FROM CUSTOMER WHERE ";

    if(txtCity.Text.length() > 0)
        sqlStmt += " CITY = '" + txtCity.Text + "' "; // London ; )

    ...

    What will be an equivalent in LINQ to accomplish the above shown sql?


    I hope there wouldn't be a way to do it.
    This is more or less VB6 way; but wait, VB6 had parameterized queries for ages but noone used them.

    Concatenating SQL queries is evil. Search Google and MSDN for "SQL Injection Attacks" to see how dangerous it is.

    Besides manually generating WHERE clauses is wrong from the proper design prespective.

    -DashNY