public void ToQueryString()
 {
     Dictionary<string, string> Collection = new Dictionary<string, string>();
     Collection.Add("A", "1");
     Collection.Add("B", "2");
     Assert.Equal("?A=1&B=2", Collection.ToQueryString());
 }
        public string GetParametersString()
        {
            var nvc = new Dictionary<string, string>();

            var properties = GetType().GetProperties();

            foreach (var prop in properties)
            {
                var propValue = prop.GetValue(this);

                if (propValue is IEnumerable && !(propValue is string))
                {
                    if ((propValue as ICollection).Count > 0)
                    {
                        var multiValuesProperty = new StringBuilder();
                        foreach (var value in propValue as IEnumerable)
                        {
                            var trimedVaule = value.ToString().Replace(" ", "");
                            multiValuesProperty.Append(trimedVaule);
                            multiValuesProperty.Append("|");
                        }
                        multiValuesProperty.Remove(multiValuesProperty.Length - 1, 1);

                        nvc.Add(prop.Name, multiValuesProperty.ToString());
                    }
                }
                else if (propValue != null)
                    nvc.Add(prop.Name, propValue.ToString());
            }
            return nvc.ToQueryString();
        }