source code bean

Archive for the ‘C#’ Category

11 Jan, 2012

MongoDB, C# and Mono

Posted by: Peter In: C#|Mono|NoSQL

MongoDB is one of the many free open source NoSQL databases that exist today. I wanted to try out how well the official drivers for C# worked when using Mono. On the MongoDB web site they have pre built binaries of MongoDB for almost every platform, i grabbed the 64 bit binary for OSX. No [...]

07 Dec, 2011

String interning in C#

Posted by: Peter In: .NET|C#

Last week a coworker sent me an interesting piece of code:   const string a = ""; const string b = ""; const string c = "hello"; const string d = "hello";   Console.WriteLine(ReferenceEquals(string.Empty, string.Empty)   ? "Not so surprising…"   : "Oh, the humanity!");   Console.WriteLine(ReferenceEquals(a, string.Empty)   ? "But I thought string was [...]

02 May, 2011

Reference types are always passed by value in C#

Posted by: Peter In: .NET|C#

Last week i had a discussion with a friend about C# and passing parameters to methods. My friend asked why it is possible to use the ‘ref’ keyword for a reference type in C# when passing it to a method, he was under the impression that reference types are passed by reference to methods. This [...]

18 Apr, 2011

A simple image sprite generator in C#

Posted by: Peter In: .NET|C#

Last week I posted the source code to a small program I wrote in Java to merge images into a sprite. This week I present the same application but in C#, pretty much translated line by line using System; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq;   namespace NSpriteGenerator {     class Program [...]

06 Apr, 2011

AppHarbor – Heroku for .NET?

Posted by: Peter In: .NET|C#|Web

I have been reading about this new startup that offers a service called AppHarbor. It seems very much as the same idea as Heroku for Ruby, but for .NET. The basic idea is that you deploy your code by pushing your code onto the server using Git, the server then builds, runs unit tests and [...]

Yesterday I installed Visual Studio 2010 SP1 on my home computer. After the installation I wanted to upgrade MVC3 to the RTM version (I had the RC version installed), so i uninstalled the RC and downloaded the new version. The installation came half way, then stopped, in the log file i found this: Installation failed [...]

08 Mar, 2011

The must have tools for C# development

Posted by: Peter In: .NET|C#

Visual Studio 2010 I don’t think Visual Studio needs an introduction. VS 2010 brought us .NET 4.0 that contains a lot of new goodies! ReSharper ReSharper is the absolut must have for Visual Studio. It provides very improved navigation and search, refactoring, code generation, code cleanup and unit testing. I have gotten so used to [...]

For the last week the news that Nokia has chosen Windows Phone 7 as their main operating system for all their new smart phones has been all over the news. A lot of people are very upset and say that Nokia should have gone with Android instead, or that they should have invested more in [...]

04 Oct, 2010

Entity Framework 4 – Code First

Posted by: Peter In: .NET|C#

Entity Framework 4 itself is interesting but what really got me hooked was the CTP 4 preview, and what Microsoft call “Code First”. Code First allows us to describe our model using regular POCO classes, instead of designing our model using either the EF editor or creating in directly in the database.

Recently I started a new assignment at a customer where we are going to build their new public web site and their intranet, both of them based on EPiServer CMS 6. The person leading the project is very found of ASP.NET MVC, so my first task was to experiment with EPiServer and ASP.NET MVC, to [...]



  • Joe: It looks like IceCoffee Script may provide the 'await' keyword to JavaScript. http://maxtaco.github.com/coffee-script/
  • Florian: Dealing with events has two primary fashions: imperative (synchronous) code, and callback (asynchronous) code. Both are legitimate styles, for some
  • Joe: I think we haven't seen true PaaS offering yet in Azure. If you use a webrole you're still running on your own VM. This is still not true multi-tena

About

Welcome to source code bean! On this site I post stuff that I encounter in my job and spare time. The content is mostly related to .NET development, but my interest in techonology is very broad, so often you will find posts on totally different subjects!