c#本质论第三版,源代码跑不起,怎么回事啊?
第11章开头的代码如下,首先是没有Main函数入口,我自己加了一个,然后运行程序就一直嘟嘟嘟嘟
响,求大神指点啊,谢谢!
响,求大神指点啊,谢谢!
namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter11.Listing11_02
{
using System;
using System.Collections;
public class Program
{
// ...
public void Sketch()
{
Stack path = new Stack();
Cell currentPosition;
ConsoleKeyInfo key; // New with C# 2.0
do
{
// Etch in the direction indicated by the
// arrow keys that the user enters.
key = Move();
switch (key.Key)
{
case ConsoleKey.Z:
// Undo the previous Move.
if (path.Count >= 1)
{
currentPosition = (Cell)path.Pop();
Console.SetCursorPosition(
currentPosition.X, currentPosition.Y);
Undo();
}
break;
case ConsoleKey.DownArrow:
case ConsoleKey.UpArrow:
case ConsoleKey.LeftArrow:
case ConsoleKey.RightArrow:
// SaveState()
currentPosition = new Cell(
Console.CursorLeft, Console.CursorTop);
path.Push(currentPosition);
break;
default:
Console.Beep(); // New with C#2.0
break;
}
}
while (key.Key != ConsoleKey.X); // Use X to quit.
}
private static ConsoleKeyInfo Move()
{
//fill in method.
return new ConsoleKeyInfo();
}
private static void Undo()
{
//fill in method.
}
}
public struct Cell
{
readonly public int X;
readonly public int Y;
public Cell(int x, int y)
{
X = x;
Y = y;
}
}
}
...全文
相关推荐
C#本质论源代码
C#本质论源代码。是对应第3版的源代码。
C#本质论第三版 高清
C#本质论第三版 高清 中文 一本C#算是略高于基础的书,值得一看
C#本质论(第三版_全_中文版)
C#本质论高清PDF 中文版 第三版 谁下谁知道 只分享经典(c# 必看)
C#本质论(第三版)
非常不错的一本书,英文版的C#本质论,C#4.0的,比较新的书,作者写得很好,极力推荐!!!
一、C#概述
原书第一章的内容非常简单,毕竟标题是Introducing C#,只是概述。从这一章看,《Essential C#12.0》并不是写给零基础学员的,正如本书《》所述,如果看这一章存在问题,那么您需要考虑换一本更浅显易懂的教材。本文不准备对原书内容做任何复述,仅以个人视角,力争一开始就陈述清楚几个关键概念,为以后学习大好基础。


