我想創建這樣最好方式對象
string data = "85-null-null-null-null-price-down-1-20"; // null if zero
我有這樣的方法的字符串對象。
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
}
我知道我可以使用一個StringBuilder
,但使用這將需要的代碼行數太多。我在這裏尋找一個簡約的解決方案。
你說你想要一個字符串,然後你顯示一個返回類型爲DataSet的方法,這是一個錯字嗎? – James 2012-07-09 15:22:42
不..我是goona在這個方法裏面的字符串。 – 2012-07-09 15:24:06
已經上了:http://stackoverflow.com/questions/7689040/can-i-format-null-values-in-string-format – 2012-07-09 15:24:06