I want to create a string object like this
string data = "85-null-null-null-null-price-down-1-20"; // null if zero
I have a method like this.
public static DataSet LoadProducts(int CategoryId, string Size,
string Colour, Decimal LowerPrice,
Decimal HigherPrice, string SortExpression,
int PageNumber, int PageSize,
Boolean OnlyClearance)
{
/// Code goes here
/// i am goona pass that string to one more method here
var result = ProductDataSource.Load(stringtoPass) // which accepts only the above format
}
I know I can use a StringBuilder, but using that would require too many lines of code. I am looking here for a minimalistic solution here.
You can do something like this:
For convenience, you could create extension methods:
And use them as follows: