Using var outside of a method

My article on the subject: Why no var on fields? To summarize: If we have “var” fields then the type of the field cannot be determined until the expression is analyzed, and that happens after we already need to know the type of the field. What if there are long chains, or even cycles in … Read more

How to create LINQ Query from string?

You have a few options: Use the the Dynamic Linq libraries to construct you queries on the fly. The best place to get started is by reading ScottGu’s blog entry. However, I don’t think these libraries support the contains method in your example. Here is a blog post explaining how to add this support. Directly … Read more

Why there are two ways of declaring variables in Go, what’s the difference and which to use?

The Variable declarations make it clear that variables are declared. The var keyword is required, it is short and expresses what is done (at the file level everything excluding comments has to start with a keyword, e.g. package, import, const, type, var, func). Like any other block, variable declarations can be grouped like this: var … Read more