using System.Collections.Generic;
public static class ExtenstionArray
public static string ToRequestContent<T>(this T model) {
var list = model.GetType().GetProperties()
val = x.GetValue(model).ToString(),
.Select(z => string.Join("=", z.name, z.val));
return "&"+ string.Join("&", list);
public string Name { get; set; }
public string SurrName { get; set; }
public int Id { get; set; }
public string Title { get; set; }
public static void Main()
User u = new User() { Name = "test", SurrName = "aa" };
Book b = new Book() { Id = 134, Title = "aass" };
Console.WriteLine( u.ToRequestContent());
Console.WriteLine( b.ToRequestContent());