After 3 years working as an IT Support Technician, I decided to change of field and get to Programming.
I am learning C# through the Wrox Beginning Visual C# 2008 book, that I use as guideline.
I have read the whole POO part (inheritance, Polymorphism,....delegates,...). I have started the second part which is Windows Programming (Winforms)
我知道很多人建议做一些有用的应用程序来练习,但是如果我还没有开始像SQL Server,LINQ或网络编程,WPF,WCF这样的概念,我怎么能做一些个人项目....在本书的最后给出了主题.
我只是想找到最好的方法:我应该先完成这本书,然后开始编码,或者我应该在没有阅读热门话题的情况下做一个项目,或直接跳到这些主题.
我不知道你是否明白我的意思,因为英语不是我的第一语言.但如果你不这样做,我可以改进我的解释.
我收到此错误消息,我无法弄清楚原因!
Error 1 'Exo5Chap12.ShortCollection<T>' does not implement interface member
'System.Collections.IEnumerable.GetEnumerator()'.
'Exo5Chap12.ShortCollection<T>.GetEnumerator()' cannot implement
'System.Collections.IEnumerable.GetEnumerator()' because it does not have the matching
return type of 'System.Collections.IEnumerator'.
E:\MyFolders\Dev\c#\Chapter12\Exo5Chap12\Exo5Chap12\exo5.cs 9 18 Exo5Chap12
Run Code Online (Sandbox Code Playgroud)
以下是具有GetEnumerator()实现的代码.怎么了?
public class ShortCollection<T> : IList<T>
{
protected Collection<T> innerCollection;
protected int maxSize = 10;
public IEnumerator<T> GetEnumerator()
{
return (innerCollection as IEnumerator<T>).GetEnumerator();
}
}
Run Code Online (Sandbox Code Playgroud) 我有一个名为Primes的类,这个类实现GetEnumerator()而不实现IEnumerable接口.
public class Primes
{
private long min;
private long max;
public Primes()
: this(2, 100)
{
}
public IEnumerator GetEnumerator()
{...}
Run Code Online (Sandbox Code Playgroud)
我不明白.我错过了什么吗?
这可能是一个愚蠢的问题,但我不明白:
我有一个名为Card的课程.我想使用MemberWiseClone()进行浅层克隆.理论卡继承自Object.所以它应该能够使用MemberWiseClone(),即使MWC()受到保护?
我遗失/遗忘了什么吗?