Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dynamically declared
Message
From
21/06/2013 10:39:58
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Dynamically declared
Environment versions
Environment:
C# 4.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01576814
Message ID:
01576814
Views:
63
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
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Next
Reply
Map
View

Click here to load this message in the networking platform