May
13th | 2008

Beware of List.Find()

Posted by Shahar A |
Filed under .Net, C# |

List<T>.Find() returns the first element found that matches a given criteria. So lets say we have List<int> and we use the Find method on it. What will be the returned value? If a number in the list matches the criteria it will be returned, but what if not? what does the variable zero contains after executing this code:

List<int> listOfInts = new List<int>(new int[] { 1,2,3,4,5,6,7,8,9});
int zero = listOfInts.Find(
    delegate(int i)
    {
        return i == 0;
    });

It has the value of…


Continue Reading...
Mar
14th | 2008

How to Get Visual Studio to Create New Classes Public by Default

Posted by Amit |
Filed under .Net, C#, Visual Studio |

This is a good one!
Every one knows that when you add a new class to a project it is private by default, but still when you compile for the first time, the compilation fails and only then you remember to add the “public” before the class name. Tired of this? Here’s what you do in [...]


Continue Reading...

Search Dev102