How to explicitly specify the size of an array parameter passed to a function
You cannot specify the size of the array parameter in the method declaration, as you have discovered. The next best thing is to check for the size and throw an exception:
public AESCBC(byte[] key, byte[] inputIV)
{
if(inputIV.Length != 16)
throw new ArgumentException("inputIV should be byte[16]");
//blah blah
}
Another option it to create a class that wraps byte[16]
and pass that through.
You can't, basically. As Jaroslav says, you could create your own type - but other than that, you're stuck with just throwing an exception.
With Code Contracts you could express this in a form which the static checker could help with:
Contract.Requires(inputIV.Length == 16);
Then the static checker could tell you at build time if it thought you might be violating the contract. This is only available with the Premium and Ultimate editions of Visual Studio though.
(You can still use Code Contracts without the static checker with VS Professional, but you won't get the contracts.)
Plug: Currently the Code Contracts chapter from C# in Depth 2nd edition is available free to download, if you want more information.