In MSDN for AES I can see the following part in the sample.
...
using (Aes aesAlg = Aes.Create())
{
aesAlg.Key = Key;
aesAlg.IV = IV;
ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);
...
} ...
I've tried to skipping the assignment of key and IV to the AES object (although setting them in the creation of the encryptor like this.
...
using (Aes aesAlg = Aes.Create())
{
//aesAlg.Key = Key;
//aesAlg.IV = IV;
ICryptoTransform encryptor = aesAlg.CreateEncryptor(Key, IV);
...
} ...
It seems to make no difference in the outcome. However, since it is a part of the sample, I worry that there is a case when it matters. It might be that I only tried examples where it doesn't show.
When do I need to assign the key and IV to the AES object?