简单教程
提交运行
代码编辑器:
@{ string[] members = {"Jani", "Hege", "Kai", "Jim"}; int i = Array.IndexOf(members, "Kai")+1; int len = members.Length; string x = members[2-1]; } <!DOCTYPE html> <meta charset="utf-8"/> <h3>Members</h3> @foreach (var person in members) { <p>@person</p> } <p>The number of names in Members are @len</p> <p>The person at position 2 is @x</p> <p>Kai is now in position @i</p>
运行结果: