ASP.NET入门经典 - 第四章

快速导航

第四章 使用C#编程

4.1 编程简介

本章内容基本上是C#语言基础,更详细的教程可以参照笔者的《C# 高级编程》系列文章,本章主要涉及到的内容为:

4.2 练习

  • 下面代码中resultsAsAString的最终值是什么?
int oneNumber = 1;
int twoNumber = 2;
string resultsAsAString = "What is my result?" + oneNumber + twoNumber;
  • 下面的代码有什么问题?
List<string> collection = new List<string>();
string valueToWrite;
for(int i=0;i<=collection.Count;i++)
{
    valueToWrite += collection[i];
}
  • 遍历整个集合的时候,何时使用for,何时使用foreach更好?

猜你喜欢

转载自www.cnblogs.com/zenronphy/p/BeginASPDotNetLearningChapter4.html
今日推荐