Apologies in advance as I'm fairly new to this so imagine this is be being a fool.
Anyway, I looking to pass individual comma delimited data into fields/variables. I am using FileHelpers and have it working and passing back data but my C# skills now fail me.
The CSV Data is:
Tom, Password
Two, PassTwo
Three, PassThree
And the code I have is :
[DelimitedRecord(",")]
public class UserDetailsLogin
{
FileHelperEngine engine = new FileHelperEngine(typeof(UserDetails));
[Test]
public void TestData()
{
string User1;
string User2;
string User3;
string Password1;
UserDetails[] res = engine.ReadFile("TestData.csv") as UserDetails[];
foreach (UserDetails user in res)
{
User1 = user.UserName;
Console.WriteLine(User1);
}
}
}
[DelimitedRecord(",")]
public class UserDetails
{
public string UserName;
public string Password;
}
Which, for the purpose of checking writes to console:
Tom
Two
Three
How would I be able to pass individual data to variables e.g:
User1 = "Tom"
Password1 = "Password"
User2 = "Two" etc etc..