1
Reply

For getting a list of objects from database and binding to grid view which loop is faster... For or For each ?

    foreach is much slower than for loop as it uses more memory space for local variables. but when it comes to type-safe iteration and avoiding null pointer exception then foreach is best option.