【发布时间】:2012-07-09 00:42:40
【问题描述】:
我想创建一个这样的字符串对象
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的方法,这是错字吗?
-
no.. 我正在处理方法中的那个字符串。
-
为什么是 -1 的问题。有什么问题?