Browsed by
Year: 2007

Explicit interface implementation

Explicit interface implementation

In C# you have a feature, which java don’t have. It’s called explicit interface implementation.The main use of this feature is to solve problems when you have to implement for example two interfaces which have both unfortunatly a same method signature: namespace testpw.ExplicitInterfaces{    public interface IA    {        void doAction();    }     public interface IB    {        void doAction();    }} The implementation of both interfaces on the same class look now like this: namespace testpw.ExplicitInterfaces{    public class TestImpl : IA, IB    {       …

Read More Read More

Filtering on DataTables

Filtering on DataTables

When you want to apply a filter to your datatable in your dataset, you can use the method Select on the class DataTable. In our current project we use this method very often, also for databinding. Recently I discover an unexpected behaviour. Let’s assume, that our datatable has 4 datarows and we will apply following filter for databinding:0=1 AND Path = ‘C:\bin’ The first expression (0=1) is added by an other method, which checks if any rows should be visible….

Read More Read More

Offline blogging tools

Offline blogging tools

There are several offline blogging tools, but two of them are interesting: Blogjet Windows Live Writer The Blogjet tool works very fine and I could also formatting my source-code. The microsoft-tool (currently it’s for free) looks even better as the blogjet-tool and I think it has more or less the same features. With both tools I could connect to my blog, but with the Blogjet tool I had a little Problem because a proposed value was wrong. The microsoft windows live…

Read More Read More

Programming several conditions in C#

Programming several conditions in C#

When you have to programme a piece of code which have several conditions you could do it in the following way: switch(a.name){    case “smith”:        CallHim();         break;    case “doyle”:        SendAMessageToHim();        break;    default:        throw new WriteNotReachableErrorException();} If you couldn’t use constants as conditions, you will implement the logic in the following way: if(a.name == smithObject.ToString()){    CallHim();}else if(a.name == doyleObject.ToString()){    SendAMessageToHim();}else{    throw new WriteNotReachableErrorException();} But if you think now there is now other possibility to implement the logic, wait! I found recently…

Read More Read More

Object oriented programming (Part 1)

Object oriented programming (Part 1)

Jonas showed me an interesting link on infoq. Unfortunately, video shows not the hole presentation, but the things which you could learn are very essential for object oriented programming. I decided, that I want to blog more about that. One of the main principles is the open-close-principle by Bertrand Meyer. But more about that and the others principles in a later post.