Should you declare methods using overloads or optional parameters in C# 4.0?

I’d consider the following: Do you need your code to be used from languages which don’t support optional parameters? If so, consider including the overloads. Do you have any members on your team who violently oppose optional parameters? (Sometimes it’s easier to live with a decision you don’t like than to argue the case.) Are … Read more

Why does this (null || !TryParse) conditional result in “use of unassigned local variable”?

I am pretty sure this is a compiler bug. Nice find! Edit: it is not a bug, as Quartermeister demonstrates; dynamic might implement a weird true operator which might cause y to never be initialized. Here’s a minimal repro: class Program { static bool M(out int x) { x = 123; return true; } static … Read more

Extension method and dynamic object

To expand on Jon’s answer, the reason this doesn’t work is because in regular, non-dynamic code extension methods work by doing a full search of all the classes known to the compiler for a static class that has an extension method that matches. The search goes in order based on the namespace nesting and available … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)