I originally wrote this encrypt/decrypt method before it was moved to the community commons module (from my Exchange module), it's an AES encryption with a 128 bit key, cipher-block chaining with PKCS #5 padding . You can have a look at the implementation of encrypt and decrypt in the community commons module. Also note the base64 encoding/decoding. I couldn't tell you exactly how to implement this in C# but I'm sure there are many examples to be found.
Encryption:
Cipher c = Cipher.getInstance("AES/CBC/PKCS5PADDING");
SecretKeySpec k = new SecretKeySpec(key.getBytes(), "AES");
c.init(Cipher.ENCRYPT_MODE, k);
byte[] encryptedData = c.doFinal(valueToEncrypt.getBytes());
byte[] iv = c.getIV();
return new StringBuilder(Base64.encode(iv)).append(";").append(Base64.encode(encryptedData)).toString();
Decryption:
Cipher c = Cipher.getInstance("AES/CBC/PKCS5PADDING");
SecretKeySpec k = new SecretKeySpec(key.getBytes(), "AES");
String[] s = encryptedPassword.split(";");
byte[] iv = Base64.decode(s[0]);
byte[] encryptedData = Base64.decode(s[1]);
c.init(Cipher.DECRYPT_MODE, k, new IvParameterSpec(iv));
return new String(c.doFinal(encryptedData));