What I really like in Visual Studio as development environment is code snippets. Well actually probably other IDE have something very similar but I do not have much of a choice in that matter as C# developer 🙂
Anyway this feature is really useful. For example while refactoring I very often use if surround snippet. Continue reading “Visual Studio code snippets”
Smart string builder
In this rare times when I was writing code that suppose to create large string from smaller chunks and with some non string parameters I was using StringBuilder class of course. Of course because string adding, or string concatenation is very costly when talking about memory utilization. It is because every time you do this:
var text = "Hello world!"+ "n"+ "How are you?";
new string is created for every ‘+’ operation in memory. Not a best way of doing strings creations. StringBuilder
is better because it do not creates strings until you call .ToString
method of StringBuilder
class. Continue reading “Smart string builder”
Expression parsing and nested properties
In one of projects I was working on, I needed to get property value from property path and property path from expression.
First, lets cover second case.
With expression in form of nested property value:
()=>object1.object2.object3.object4
we cannot take simple value of some property, because we have only root object, object1
. Continue reading “Expression parsing and nested properties”
WebSocket libraries comparison
Web project often requires to push data to clients as fast as possible, whenever it is necessary without waiting for client request. It is perfect for website with real time communication between users, like with online communicators for example. Or document collaboration tools. Or maybe system status updates on long running calculation/tasks performed by server. In every case two way communication mechanism is ideal. Continue reading “WebSocket libraries comparison”
Ninject and WCF
Ninject is very simple and in the same time powerful IoC container. I used it in few project and had very little or none problems.
Most of the time getting instances from Ninject kernel requires simple line with binding expression, or even this is sometime unnecessary if type is self bind able (i.e. if it is concrete class with parameterless constructor).
Little harder is getting Ninject to work with WCF. You cannot just bind interfaces types because proxies which implements them are created through .NET mechanism. Luckily WCF system is very flexible and mostly can be changed/extended with custom functionality. Continue reading “Ninject and WCF”