Posts

Showing posts from October, 2012

JavaScript I Can Live With

Update 10/2016 - This posting is better viewed in my new blog . I've never been a fan of JavaScript. Not because of the language itself. Syntactically it's a lot like C# (which I love) and functionally it provides a wealth of features for web programming. My issue has always been with actually writing the code. Due to the fact that JavaScript isn't statically typed it's difficult to create truly good tooling and it's always felt to me like programming JavaScript in notepad is almost as good as with the best IDE. In my book that makes it a very cumbersome language to work with for all but the simplest applications. After working with C# for the last eight years and experiencing the power that a statically typed language and a good IDE provide I find it very painful to go back to a language that doesn't. Maybe I'm just spoiled but going back to a language like JavaScript makes me feel like I've moved back in time a decade. Enter TypeScript. TypeScrip

Implicit Type Conversion and Arrays

Update 10/2016 - This posting is better viewed in my new blog . I came across something I found sort of interesting a week or two ago. I had an array of integers that I wanted to use in populating a ComboBox for a tool I was working on. I started to call the ComboBox.Items.AddRange method which simply takes an array of objects. To my surprise I received the wonderful "The best overloaded method match for 'System.Windows.Forms.ComboBox.ObjectCollection.AddRange(object[])' has some invalid arguments. Hmm, strange. Doesn't everything in .NET derive from object? I quickly opened my favorite playground console application (where I do most of my quick coding tests) and starting poking around with objects, object arrays and how type conversions between them works. First I performed a sanity check: int i = 5; object o = i; Sanity confirmed. No complaints from the compiler. Integers can indeed be implicitly converted to objects because they inherit from object. Now