C#关于数组的问题?

mezzi100 2008-08-06 04:15:21
在一个页面中需要存储的值按如下方式排列:

"9" "14" "任意字符串1" //第一次存储
"9" "15" "任意字符串2" //第二次存储
....//第N次存储

不想使用datatable进行存储,想用一个public的数组存储,字符串型的数组
应该如何写这样一个数组?
...全文
74 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
mezzi100 2008-08-06
  • 打赏
  • 举报
回复
我用了泛型数组了,谢谢各位。
MicroYee 2008-08-06
  • 打赏
  • 举报
回复
一个简单的数组也可以
每次存储几个字符串是知道的,
用最终的数组除以这个长度,就是存储信息的长度。。
相对的,中间的信息也可通过这种方式获取到。。。

:) 不知道我说的你明白不
tootto 2008-08-06
  • 打赏
  • 举报
回复
Public MyClass
{
private string firstString;
private string secondString;
private string otherString;

public MyClass(string firstString, string secondString, string otherString)
{
firstString = firstString;
firstString = secondString;
otherString = otherString;
}

public string FirstString
{
get...
set...
}
...
...
...
}

List<MyClass> myClasses = new List<MyClass>();
myClasses.Add(new MyClass("1","2","string1"));
myClasses.Add(new MyClass("1","3","string2"));
fanym 2008-08-06
  • 打赏
  • 举报
回复
对字符串分割
string[] my_array = PrintId.Split(',');
编程有钱人了 2008-08-06
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 hbxtlhx 的回复:]
可以使用泛型表:

List <string[]> table=new List <string[]>();
table.Add(new string[]{"9","14","任意字符串1"});
table.Add(new string[]{"9","15","任意字符串2"});
...
[/Quote]
jiang_jiajia10 2008-08-06
  • 打赏
  • 举报
回复
List <string[]> table=new List <string[]>(); 
table.Add(new string[]{"9","14","任意字符串1"});
table.Add(new string[]{"9","15","任意字符串2"});
...
引用
hnyygy 2008-08-06
  • 打赏
  • 举报
回复
ViewState["Sort"] = "OpenDate";
你看这个行不行.
hnyygy 2008-08-06
  • 打赏
  • 举报
回复
ViewState["Sort"] = "OpenDate";
你看这个行不行.
北京的雾霾天 2008-08-06
  • 打赏
  • 举报
回复
可以使用泛型表:

List<string[]> table=new List<string[]>();
table.Add(new string[]{"9","14","任意字符串1"});
table.Add(new string[]{"9","15","任意字符串2"});
...
stone_tao 2008-08-06
  • 打赏
  • 举报
回复
二维数组
mezzi100 2008-08-06
  • 打赏
  • 举报
回复
还有CSDN中自己发的帖子为什么自己不能修改?我现在想补充一下都不行。
fuda_1985 2008-08-06
  • 打赏
  • 举报
回复
。。将每次存储的用个什么东西分隔变为一个串存?

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧