当前位置: 首页 > 开发语言 > ASP.net > ASP.net教程 > C# 实例—Array 数组

C# 实例—Array 数组

时间:2020-10-16 20:09来源:未知 点击:
分享到:

C# 实例—Array 数组:

Web Pages 实例

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="/statics/demosource/showrazor.css" />
</head>
<body>
<span class="marked">@{
string[] members = {&quot;Jani&quot;, &quot;Hege&quot;, &quot;Kai&quot;, &quot;Jim&quot;};
 
int i = Array.IndexOf(members, &quot;Kai&quot;)+1;
int len = members.Length;
string
x = members[2-1];
}
</span><html>
<body>
<h3>Members</h3>
 
<span class="marked">@foreach (var person in members)
{
<p>@person</p>
}</span>
<p>The number of names in Members are <span class="marked">@len</span></p>
 
<p>The person at position 2 is <span class="marked">@x</span></p>
<p>Kai is
now in position <span class="marked">@i</span></p>
 
</body>
</html>
 

(责任编辑:admin)
推荐教程
关于我们--广告服务--免责声明--本站帮助-友情链接--版权声明--联系我们--网站地图          黑ICP备17004983号-1