public void TestMethod1() { var t = new testClass { channel = "ch1", username = "******", password = "******", sessionId = Guid.NewGuid().ToString() }; var fields = new string[] { "username", "password", "sessionId", "channel" }; Dictionary<string, string> rqst = new Dictionary<string, string>(); var sid = t.GetValue<string>("sessionId", null); fields.ToList().ForEach(f => rqst[f] = t.GetValue<string>(f, null)); }
public void TestMethod1() { var t = new testClass { channel = "ch1", username = "******", password = "******", sessionId = Guid.NewGuid().ToString() }; var fields = new string[] { "username", "password", "sessionId", "channel" }; Dictionary <string, string> rqst = new Dictionary <string, string>(); var sid = t.GetValue <string>("sessionId", null); fields.ToList().ForEach(f => rqst[f] = t.GetValue <string>(f, null)); }