C# Operator Overloading

This is my first C# operator overloading implementation that can be used in many specific projects. The tutorial from MSDN it shows only a basic class that implements the operators.

In this case the class presented on MSDN doesn’t have any usability, other than learning how to implement the operator overloading.

Next i present you an class who can be used as is. 😀

Next i show you an usage . The code doesn’t need any comments – is simple. The variable info can be used like an string, and using the operator  “+” you can add byte array from any function who returns this kind of data.

At the end of the function there is an explicit cast from type “Bytes” to byte array.

I used this class generally for generation of byte array. This byte arrays contains specific printer commands. As you can see in the sample code – class FiscalReceipt – the printer used in this case is Bixolon SRP 350.

Next i’ve attached the class for specific Bixolon SRP 350 codes.

Code can be downloaded from : 03053012

Enjoy 🙂

Posted in C#.