Referring to the scripts that handles the [URL="http://dnsbl.tornevall.org/?do=download"]bitmasking for the dnsbl.tornevall.org-scripts[/URL], this is how to make the same routine in C-Sharp. Based on the Hashtable-namespace to get it as similar as possible.

[code]
[FONT=Courier New][COLOR=blue]public[/COLOR] [COLOR=#2b91af]Hashtable[/COLOR] BitMask([COLOR=blue]int[/COLOR] MaskVal, [COLOR=blue]params[/COLOR] [COLOR=blue]int[/COLOR][] bitcheck)[/FONT]
[FONT=Courier New] {[/FONT]
[FONT=Courier New] [COLOR=#2b91af]Hashtable[/COLOR] ReturnThis = [COLOR=blue]new[/COLOR] [COLOR=#2b91af]Hashtable[/COLOR]();[/FONT]
[FONT=Courier New] [COLOR=#2b91af]Hashtable[/COLOR] Arr = [COLOR=blue]new[/COLOR] [COLOR=#2b91af]Hashtable[/COLOR]();[/FONT]
[FONT=Courier New] [COLOR=blue]int[/COLOR] loadbits = 8;[/FONT]
[FONT=Courier New] [COLOR=blue]try[/COLOR] { loadbits = bitcheck[0]; } [COLOR=blue]catch[/COLOR] ([COLOR=#2b91af]Exception[/COLOR]) { }[/FONT]
[FONT=Courier New] [/FONT]
[FONT=Courier New] [COLOR=green]/*[/COLOR][/FONT]
[COLOR=green][FONT=Courier New] * PHP SOURCE[/FONT][/COLOR]
[COLOR=green][FONT=Courier New] * [/FONT][/COLOR]
[COLOR=green][FONT=Courier New] * function bitmask ($bit = '', $loadbits = 8)[/FONT][/COLOR]
[COLOR=green][FONT=Courier New]* {[/FONT][/COLOR]
[COLOR=green][FONT=Courier New] * for ($i = 0 ; $i < $loadbits ; ++$i) {$arr[] = pow(2,$i); } // Automatisera bitvärden[/FONT][/COLOR]
[COLOR=green][FONT=Courier New] * for ($i = 0 ; $i < count($arr) ; ++$i) {$mask[$i] = ($bit & $arr[$i]) ? '1' : '0';} // Sätt 1 till de bitvärden som är påslagna[/FONT][/COLOR]
[COLOR=green][FONT=Courier New] * return $mask;[/FONT][/COLOR]
[COLOR=green][FONT=Courier New] * }[/FONT][/COLOR]
[COLOR=green][FONT=Courier New] */[/FONT][/COLOR]
[COLOR=green][FONT=Courier New] [/FONT][/COLOR]
[FONT=Courier New] [COLOR=blue]for[/COLOR] ([COLOR=blue]int[/COLOR] i = 0 ; i < loadbits ; ++i) {Arr.Add(i.ToString(), [COLOR=#2b91af]Math[/COLOR].Pow(2, i).ToString());} [COLOR=green]// Automatisera bitvärden[/COLOR][/FONT]
[COLOR=blue][FONT=Courier New]for[/FONT][/COLOR][FONT=Courier New] ([COLOR=blue]int[/COLOR] i = 0; i < Arr.Count; ++i) {ReturnThis.Add(i.ToString(), [COLOR=#2b91af]Convert[/COLOR].ToInt32([COLOR=#2b91af]Convert[/COLOR].ToBoolean(MaskVal & [COLOR=#2b91af]Convert[/COLOR].ToInt32(Arr[i.ToString()].ToString()))).ToString());}[/FONT]
[COLOR=blue][FONT=Courier New]return[/FONT][/COLOR][FONT=Courier New] ReturnThis;[/FONT]
[FONT=Courier New] }[/FONT]
[/code][FONT=Courier New][/FONT]