Proper Linq where clauses

EDIT: LINQ to Objects doesn’t behave how I’d expected it to. You may well be interested in the blog post I’ve just written about this… They’re different in terms of what will be called – the first is equivalent to: wheras the latter is equivalent to: Now what difference that actually makes depends on the implementation of Where being called. If … Read more

Unity3d restart current scene

You must ask the scene manager to load the scene using LoadScene You were just retrieving the build index of the current scene. Also, about yourcompilling error, you have forgotten the semi-colon at the end of the line 😉

What is and how to fix System.TypeInitializationException error?

Whenever a TypeInitializationException is thrown, check all initialization logic of the type you are referring to for the first time in the statement where the exception is thrown – in your case: Logger. Initialization logic includes: the type’s static constructor (which – if I didn’t miss it – you do not have for Logger) and field initialization. Field initialization is pretty … Read more

Incorrect string value: ‘\xEF\xBF\xBD’ for column

\xEF\xBF\xBD is the UTF-8 encoding for the unicode character U+FFFD. This is a special character, also known as the “Replacement character”. A quote from the wikipedia page about the special unicode characters: The replacement character � (often a black diamond with a white question mark) is a symbol found in the Unicode standard at codepoint U+FFFD in the … Read more

Associating enums with strings in C#

I like to use properties in a class instead of methods, since they look more enum-like. Here’s an example for a Logger: Pass in type-safe string values as a parameter: Usage:

Why not use Html.EditorForModel()

Ok I just discovered about the EditorForModel in MVC and I want to know when I should use this instead of an EditorFor on each of my property? And why does when I add a strongly typed view it does not use this and build an EditorFor on every property? I’m late on this… but thanks for the info!