Question: I need to write a program (in C#), to run in the client local machine, that will show a list of our windows servers (Sort of the server names in a ListBox) and let the user choose and subsequently connect via RDC. However, the program needs to know if the user is already connected to one of the listed servers, in which case the client will be advised to first disconnect from previous session before continuing. The question is how to detect if there is already such an active connection in the user local machine? And better yet, would it be possible to detect the ip address of this server, so that we can ignore the connection if it is not in one of our servers?

Answer: 
If you want to convert number to hex representation just use ToString with "x" as param:

```
2010.ToString("x")  output: "7da"

```

However, I don't really understand what to you want to achieve if you say that for 2010, you expect 200A.
Are you really sure that your example is correct? Why do you have a hex-number, where the first part is with base 10 and the second part is base 16?

*Normal* would one of these:

* 2010 => 0x07DA
	+ complete hex
* 2010 => 0x140A
	+ the number is broken half-way and each part is hex
* 2010 => 0x2010
	+ bcd encoded as found on wikipedia (where else) ;-)

After some googling and thinking here is my first idea:

* Put everything into an [BinaryReader](http://msdn.microsoft.com/en-us/library/system.io.binaryreader.aspx).
* Get all values individually out of it by calling [BinaryReader.ReadByte()](http://msdn.microsoft.com/en-us/library/system.io.binaryreader.readbyte.aspx) and cast it to an int
* Multiply each value first by 10, then divide by 16
* Put all of this individual values into a `List<int>`
* use `Math.Pow(value, 10 * (List.Count - indexOfValue))` to aggregate all these values