XtraGrid FocusedRowChanging event

I wondered why there isn’t such an event in the DevExpress XtraGridView but there is, it’s just called BeforeLeaveRow



It’s great for some validation code and if it fails you can just set e.Allow to false


Example for extension methods in C#

Today I found one real world example for using extension methods in C#.

Maybe you know this code snippet from your own code:
If(object != null)
MessageBox.Show(„Value:“ + object.ToString().Trim());

I think it looks way to complex, for this stupid task.
Now lets write a extension method which checks for us

=> if the object is null return an empty string

=> if the object is a whitespace string return an empty string too

=> if the object is a normal string, returns it but with a automated trim() to remove annoying white spaces.

How to achieve that:

1. Create a public static class called „StringOptimizer“ and then create the function ToStringIntelligent.

public static class StringOptimizer
public static string ToStringIntelligent(this object _object)
if (_object == null)
return string.Empty;
return _object.ToString().Trim();

See the extension in the parameter _object. You use this before parameter declaration, that’s all.

Now to call this function your just do this:
Console.WriteLine("Value:" + item.ToStringIntelligent());
Note, no validation have to happen here, cause we do it in the extension method already. Extra plus is, that this method actually works with all types that derives from object, so you can use it with your string variables as well. Of course, we could use string.IsNullOrEmpty() function from the .NET framework, but I like to do the validation in just one method, instead of writing validation code for all string objects manually.

Another example is here on codeproject

Software architecture in .NET Entity Framework app.

First I was a little bit confused how to structure my applications when I use .NET EF.

Here’s a good video where you’ll extract your Entity Framework Model to a separate class library, which makes it easier to update clients or reuse your model in other projects like WPF Service, WEB, etc.

If you need further Business Logic you can follow this articles.


Start with prototyping Today!

I couldn’t believe that there is no complete free mockup app out there. And I was right. After wasting a lot of time with searching I found one, which fulfilled all my dreams <3: Pencil

Why I love it:
– Easy to use
– All relevant shapes for Desktop GUI, Web, IPhone, etc
– Open source

Check it out:


Introduction to Microsoft’s Entity Framework (Database First)

Great Video and Description about the Database First Approach with the Entity Framework. I used it already in my last project about a little web reporting tool in MVC 4 and I was really impressed how easy and powerful it is.

Check it out: