I enjoyed spending some time after creating some very useful (at least to me 😛 ) C# helper functions for string operation. So here is the gist of it Continue reading →
An XML needs to be parsed – I was told the other day. My first questions from experience, how big the XML is going to be? Do we know the schema? The answer : It’s never going to be bigger than few lines, as we use it to store our application’s menu – which may or may not have child(ren). And yes we know the XML schema. Enough said. Continue reading →
If you’re families with Different Types of SQL Joins which are used to query data from more than one tables, LINQ has a JOIN query operator that provide SQL JOIN like behavior (and syntax … depending on which LINQ syntax you prefer Query or Fluent syntax). To drill down LINQ versus SQL join Continue reading →
Fact: What happens with IQueryable<T> is different than with sequences. An instance of IQueryable<T> receives an expression tree it can inspect to decide what processing it should perform.
In principle, as soon as we start enumerating the content of object type; say Customers for example, then expression tree it contains gets analyzed, SQL is generated and executed, and the results of the database query are returned as Customers objects.I don’t want to go into detail about how things work here, but Continue reading →
Upon checking on MSDN, the only advantage of FindAll I found is backwards compatibility until .NET 2.0 on the other hand, Where seemed to be introduced in .NET 3.5 … Technically, Where should outperform FindAll for large number of records as despite the observations that on small set, these two would likely perform comparably. The reason is their mechanisms.
FindAll copies the matching elements to a new list, whereas Where just returns a lazily evaluated sequence – no copying is required. That said in the case of “FindAll”, the new List created to contain the results will have to dynamically grow to contain additional results. Memory usage of FindAll will also start to grow exponentially as the number of matching results increases where as … “Where” should have constant minimal memory usage.
Below are some code snippets that I have prepared initially, if you do not find one that you are looking for, just drop me an E-mail or just a comment below would suffice.
|Data table to LINQ||combine the ease of the database access layer with LINQ queries||zip|
|filter asp:GridView using LINQ||Depending on what the user has selected from the drop down, records of a gridview is updated||zip|
|Get cells of a selected row||get the text of all cells using LINQ and perform queries for Update/Delete/Insert in the datbase||zip|