activa's blog

.NET, Web, Mobile and more stuff I can't stop talking about

Browsing Posts tagged .NET

Adding support for SQLite to a Windows Phone app is actually very easy. Vici CoolStorage, an open-source data access layer and ORM, allows you to add local SQLite db access to your Windows Phone app with just a few lines of code, even if you don’t want to use the ORM features at all.

We all love unit tests (do we?). Yes we do (repeat 100 times). And we all love mocking for making life easier, but sometimes we just want to write some simple unit tests that don’t require any mocking at all, because the code you are testing is easy to test without having to resort to [...]

What’s the hardest part of creating any open-source project? No, not writing the code. No, not helping users in the support forum… I’ll tell you: writing documentation, especially when the documentation is not in your native language. So that’s what I have been doing for the last few weeks (or should I say “months”?). In [...]

First some basics: in .NET there are reference types and value types. Reference types are always accessed through a reference (a pointer actually) while value types, well, are not. The .NET documentation tries to sum it up in one sentence: A data type is a value type if it holds the data within its own [...]

This is another one in the series “heck, I never thought of that”… Like most of these articles, if you already knew this trick, ignore me… Let’s say you have a generic class with a new() constraint on the type parameter. This means that you are allowed to create new objects of the generic type, [...]

Many of you know me from some open source projects that are hosted on CodePlex: CoolStorage.NET (ActiveRecord style object mapper) ProMesh.NET (MVC web application framework) LazyParser.NET (late-bound C# expression parser) The next project has been in development for quite a while and is closely related to the other projects, as it is being used in [...]

Like many tips & tricks concerning programming languages, what I will present here will be so utterly obvious to some C# developers, but could be an eye-opener to others. How often do you write something like this? if (token == "A") tokenNumber = 1; else if (token == "B") tokenNumber = 4; else if (token [...]

How many times have you written some timing code around a method call? If the answer is never, move on, skip this article… For timing purposes, I always use a simple “TimeRunner” class that allows you to accurately measure the time it takes to execute a specific method. A kind of “poor man’s profiler”. The [...]

Constructing related .NET objects (an “object graph”) from XML files is a familiar challenge to most developers out there. Although it is not hard to write something like that: just read the tokens and fill the appropriate objects. In most cases, the code produced is not very readable and hard to maintain, because the problem [...]

Working with nullable types using reflection is not that hard, but sometimes you have to think about it for a bit or browse the help file before you can actually use it correctly. What I will list here is not rocket science, but it could be helpful to have all the nullable-related stuff in one [...]