Question: I have many table in my database it contain many key relation. i need to list out the table and its corresponding key name and the relationship table.

Answer: 
Use the builtin [`Convert.ToByte()`](http://msdn.microsoft.com/en-us/library/c7xhf79k%28v=VS.95%29.aspx) and read in chunks of 8 chars without reinventing the thing..

Unless this is something that should teach you about bitwise operations.

Update:

---

Stealing from Adam (and overusing LINQ, probably. This might be too concise and a normal loop might be better, depending on your own (and your coworker's!) preferences):

```
public static byte[] GetBytes(string bitString) {
    return Enumerable.Range(0, bitString.Length/8).
        Select(pos => Convert.ToByte(
            bitString.Substring(pos*8, 8),
            2)
        ).ToArray();
}

```
Get the characers in groups of eight, and parse to a byte:

```
string bits = "0000101000010000";

byte[] data =
  Regex.Matches(bits, ".{8}").Cast<Match>()
  .Select(m => Convert.ToByte(m.Groups[0].Value, 2))
  .ToArray();

```