ALLINSIGHT

Home of the AlmostImplementedException

February, 2013

Implementation of a string reverse Extension Method

This is a follow-up of Introducing Extension Methods This method is an extension of the string-class. It reverts a string in a very efficient way and it is widely used around the world. Faster methodes use either unsafe code or only work fast on very short strings. Share :

, , ,

How to save multiple numbers into one byte

Sometimes you have to work with alot of numbers and want to save them in a file. Especially when you want to save alot of small numbers, it is inefficient to use a whole byte, or worse an int. When i started to write a program to search a specific pattern of moves played in […]

,

An easy way to measure a functions performance

At some point in the development of a function or application we ask our self: “Is this the best way to do it”. This is the moment for StopWatch to step forward and help us out. Normaly we would add StopWatch to the method we want to measure and remove the code afterwards. But that’s […]

Compile code at runtime

Sometimes it is necessary to compile code explicitly at runtime. For example you can create a small user defined shell. Today I will show you how this can be done. At first we need the following: MemoryStream, StreamWriter and namespaces System.Reflection and System.CodeDom.Compiler. This works as follows: Define a source code that will be compiled […]

, , , , ,

Introducing Events

Sometimes we have to know what happens inside other objects like a collection where new entries are added or removed. So we have to make use of a nice feature called Events. In this post I will give you a first insight in Events with a snippet for an observable collection called WatchedList. Observable collections […]

,

Introducing Extension Methods for Arrays

With Extension methods you can extend the existing funtionality of objects and types. In this case we will extend the functionality of an Array. So we need to create two extensions. One for changing the size and one for appending a new element. What do we need for this? At first we need a static […]

, , , ,