Directory Freebies VS CheatSheet Forum

RSS

Email

Translate

Home About Archive Privacy Contact Advertise Write for Dev102
Posted by moshe on Jul 28th, 2009 | Filed under .Net, C# | 7 Comments

Last week, I stumbled upon the following piece of code:

 

IList<double> doubles = new List<double> {22.123, 400.12, 100.22};
foreach (int number in doubles)
{
    Console.WriteLine("The Current Number Is : {0}", number);
}

Can you see the bug in that code? We convert all of the doubles in the list to integers, truncating them. I was very surprised that the compiler didn’t warn me about this issue, especially because the compiler would not let me write this code:

 


Continue Reading...
Posted by Shahar Y on Apr 23rd, 2008 | Filed under .Net, WPF | 5 Comments

DataTemplates are a great feature introduced in WPF, it allows to determine how data is presented and how data binding accesses the presented data. Just as we can apply a visual style to a specific UI control, we can do it for a specific data type. There is just one problem here, DataTemplates are good [...]


Continue Reading...

Whenever we need to implement an interface in C#, two options pops up (click Ctrl+’.’):

Implicit vs explicit interface implementation, what shall be selected? before making a decision, lets understand what is the difference between those two.
Solving the diamond problem:
The diamond problem is related to object oriented languages that allow multiple inheritance. The problem raises when [...]


Continue Reading...
Write Article for Dev102

Write for Dev102!

We pay for user submitted tutorials and articles that we publish. Anyone can send in a contribution

Learn More