Let me first state that I'm a new C# (ASP.NET) developer, spending the
last 8 years with ASP and having attended 2 fairly basic ASP.NET
courses, so my knowledge is a dangerous case of "I know how to do that
in ASP, so it must be possible in ASP.NET"
Here's what I want to do, which oddly is not something I've done in
ASP:
I have a set of string in pairs, such as
sUsernameAAA = "aaa"
sPasswordAAA = "aaap"
sUsernameBBB = "bbb"
sPasswordBBB = "bbbp"
sUsernameCCC = "ccc"
sPasswordCCC = "cccp"
up to, say, FFF.
I pass to a function that uses these a string such as "bbb". I want to
loop through all these values until a match on a 'Username' is found,
and then set a new variable to be the corresponding 'Password'
my thought was that I could create an Array, such as "string[,]
myStrings { {"aaa","aaap "} {"bbb","bbbp "} {"ccc","cccp "} ... } and then
use a loop from 0 to myString.GetUpp erBound and check against the first
dimension until a match is found, then set the new password variable to
the second dimension.
Does that make sense? If so, is it a good method?
I was also wondering if an object could be used, though I'm not really
sure what I'm talking about here, but figured someone might ;)
any comments would be appreciated, as long as they are constructive and
understanding of my newness to ASP.NET and C#
last 8 years with ASP and having attended 2 fairly basic ASP.NET
courses, so my knowledge is a dangerous case of "I know how to do that
in ASP, so it must be possible in ASP.NET"
Here's what I want to do, which oddly is not something I've done in
ASP:
I have a set of string in pairs, such as
sUsernameAAA = "aaa"
sPasswordAAA = "aaap"
sUsernameBBB = "bbb"
sPasswordBBB = "bbbp"
sUsernameCCC = "ccc"
sPasswordCCC = "cccp"
up to, say, FFF.
I pass to a function that uses these a string such as "bbb". I want to
loop through all these values until a match on a 'Username' is found,
and then set a new variable to be the corresponding 'Password'
my thought was that I could create an Array, such as "string[,]
myStrings { {"aaa","aaap "} {"bbb","bbbp "} {"ccc","cccp "} ... } and then
use a loop from 0 to myString.GetUpp erBound and check against the first
dimension until a match is found, then set the new password variable to
the second dimension.
Does that make sense? If so, is it a good method?
I was also wondering if an object could be used, though I'm not really
sure what I'm talking about here, but figured someone might ;)
any comments would be appreciated, as long as they are constructive and
understanding of my newness to ASP.NET and C#
Comment