src/openSourceC.DotNetLibrary.Core/XmlSerialize.cs
/// <summary>
///		Encrypts and serializes the specified object using the specified key and
///		initialization vector and returns a base 64 encoded string of the encrypted data.
/// </summary>
/// <typeparam name="TObject">The type of the object to serialize.</typeparam>
/// <typeparam name="TSymmetricAlgorithm">The type of the cryptographic object used to
///		perform the symmetric algorithm.</typeparam>
/// <param name="obj">The <see cref="object"/> to serialize.</param>
/// <param name="key">Encryption key.</param>
/// <param name="iv">Encryption initialization vector.</param>
/// <param name="supportXsiNamespace"><b>true</b> to support xsi namespace (i.e. xsi:type,
///		xsi:nil, xsi:schema, xsi:schemaLocation, and xsi:noNamespaceSchemaLocation).</param>
/// <returns>
///		An XML formatted string representation of the object.
/// </returns>
Encrypts and serializes the specified object using the specified key and
initialization vector and returns a base 64 encoded string of the encrypted data.
Encrypts and serializes the specified object using the specified key and initialization vector and returns a base 64 encoded string of the encrypted data .
public static string EncryptToBase64String<TObject, TSymmetricAlgorithm>(TObject obj, byte[] key, byte[] iv, bool supportXsiNamespace = false)
			where TObject : notnull
			where TSymmetricAlgorithm : SymmetricAlgorithm, new()
		{
#if DEBUG
			try
			{
#endif
				return Encryption.EncryptToBase64String<TSymmetricAlgorithm>(key, iv,
					delegate (CryptoStream cryptoStream)
					{
						Serialize<TObject>(obj, cryptoStream, supportXsiNamespace, false);
					}
				);
#if DEBUG
			}
			catch (Exception)
			{
				throw;
			}
#endif
		}
public static string EncryptToBase64String < TObject , TSymmetricAlgorithm > ( TObject obj , byte [ ] key , byte [ ] iv , bool supportXsiNamespace = false ) where TObject : notnull where TSymmetricAlgorithm : SymmetricAlgorithm , new ( ) { if DEBUG try { endif return Encryption . EncryptToBase64String < TSymmetricAlgorithm > ( key , iv , delegate ( CryptoStream cryptoStream ) { Serialize < TObject > ( obj , cryptoStream , supportXsiNamespace , false ) ; } ) ; if DEBUG } catch ( Exception ) { throw ; } endif }
Encrypts and serializes the specified object using the specified key and
initialization vector and returns a base 64 encoded string of the encrypted data.
Encrypts and serializes the specified object using the specified key and initialization vector and returns a base 64 encoded string of the encrypted data .
An XML formatted string representation of the object.
An XML formatted string representation of the object .
obj
TObject
The  to serialize.
The to serialize .
key
byte[]
None
iv
byte[]
Encryption initialization vector.
Encryption initialization vector .
supportXsiNamespace
bool
None
typeparam
The type of the object to serialize.
The type of the object to serialize .
typeparam
The type of the cryptographic object used to
perform the symmetric algorithm.
The type of the cryptographic object used to perform the symmetric algorithm .