取决于var count构建字符串

时间:2014-05-05 03:24:09

标签: c#

我有List<string> num。根据num的数量,我需要构建一个字符串,如:

如果num由561924630638

组成
{"formType":"Status", "postDataList":[{"textWithMentions":{"text":"gogogo"}},{"imageData":{"imageIds":["561924630638"], "typeAndSizes":["561924630638,0,300,290"]}}], "news":false, "toStatus":true}

如果num由561924630638561924630894

组成
{"formType":"Status", "postDataList":[{"textWithMentions":{"text":"gogogo"}},{"imageData":{"imageIds":["561924630638","561924630894"], "typeAndSizes":["561924630638,0,300,290","561924630894,0,300,290"]}}], "news":false, "toStatus":true}

1 个答案:

答案 0 :(得分:0)

List<string> _num;
List<string> num
{
   get
   {
      return _num;
   }
   set
   {
      _num = value;

      // Check the value here and do what you need
      if (_num.Contains("561924630638"))
      { } 
      else if (_num.Contains("561924630638") && _num.Contains("561924630894"))
      { } 
   }
}