Browse by Tags
All Tags »
software »
C# (
RSS)
This piece of code results in a warning. 1: class Test 2: { 3: public static void Main() 4: { 5: object obj = "Senthil" ; 6: string myName = "Senthil" ; 7: Console.WriteLine(obj == myName); 8: } 9: } The compiler says “warning CS0252...
The previous post discussed having anonymous methods as event handlers and ended with a question – why doesn’t unsubscription work while subscription works out alright? Vivek got the answer spot on – the way the C# compiler handles and translates anonymous...
The syntactic sugar offered by anonymous methods makes them great candidates for writing event handlers; together with smart type inference, they reduce the amount of code written by an order of magnitude. And that’s without considering the power offered...
You're writing this really cool and innovative class to calculate the first hundred thousand natural numbers. You think about the API, and you realize that returning an array of the numbers a) might take a long time to complete, and b) is going to...
My colleague Soundar discovered this rather interesting behavior. 1: class Test 2: { 3: public static void Main() 4: { 5: Test test = null ; 6: 7: Console.WriteLine(" {0} ", test); 8: Console.WriteLine(" {0} ", null ); 9: } 10: } If...
Take a look at the following short snippet of code. 1: using System; 2: 3: struct S 4: { 5: public int X; 6: } 7: 8: class C 9: { 10: /* More code here */ 11: } 12: 13: class Test 14: { 15: public static void Main() 16: { 17: C c = new C(); 18: c.S.X...
If you use Skype , do you know that you can program against it? Head over to developer.skype.com if you're interested. There's a COM API, one for Java and even one for Python. Just to show how easy it is, we'll write a bot in .NET that will...