>Hi,
>
>I have code like this:
>
>
NetworkCredential cred = new NetworkCredential(smtpUser, smtpPassword);
> NetworkCredential cred1 = new NetworkCredential(justUser + "1" + justCredDomain, smtpPassword);
> NetworkCredential cred2 = new NetworkCredential(justUser + "2" + justCredDomain, smtpPassword);
> NetworkCredential cred3 = new NetworkCredential(justUser + "3" + justCredDomain, smtpPassword);
> NetworkCredential cred4 = new NetworkCredential(justUser + "4" + justCredDomain, smtpPassword);
>
>
>How can I make this flexible where I can switch from 5 variables to 7 or whatever amount I want?
>
>I then need to use these in a loop where I send emails from different email address each pass through the loop. For example, first pass uses cred, second cred1, 3rd Cred2, etc and then when cred4 is reached the next loop would be cred again.
>
>I suppose some type of collection? Can anyone give me an example showing how to declare these and how to use them in later code? I am using C#.
>
>Thanks
One possibility is to create a List of that type.
If it's not broken, fix it until it is.
My Blog