If you get others, try to tend to those first and you may see this error magically disappear. Here’s why. Imagine you have classes like these: // In assembly X public class X { public virtual void Mehtod() { ...; } // typo in the name } // In a separate assembly, Y public class Y : X { public override void Method() { ...; } } This won’t compile because of “No suitable method found to override�.
The two method names are different due to a typo. However, it’s X’s that you want to fix, not Y’s. Now suppose you fix it, but you accidentally introduce another mistake: public class X { public virtual void Method() { ...; } public int Property() { get { return 47; } } // Syntax error } You will still get the “No suitable method found to override�
Error even though it does not apply. The reason for this is very simple: X didn’t compile, so how can you even begin to compile Y which derives from it? The C# compiler uses a trick and goes by the last successfully-compiled version of X, and that one still has the misspelt Mehtod in it.
The error won’t go away until X compiles again.
The C# compiler uses a trick and goes by the last successfully-compiled version of X" I think this only applies if they are in different assemblies. – CodeInChaos Sep 24 at 9:42 Thanks, this actually helped quite a bit.. – BlueButtons Sep 24 at 9:43 @CodeInChaos: yeah, I did mention in the comments that X and Y are supposed to be in separate assemblies. – Timwi Sep 24 at 9:57.
Hmm.. I have a method called WordCount. For some reason when I try to compile my program, it keeps giving me that error that "no suitable method found to override" Now I think I understand... with ToString() you use override because it is a virtual method on object (i.e. Object has a method declared as public virtual string ToString()), and you are using polymorphism to change the implementation.
If you are adding a new method you aren't overriding anything; just add: public int WordCount() { ... } If you wanted to allow future subclasses to change this implementation (via polymorphism), you would declare it as virtual: public virtual int WordCount() { ... } and then a subclass could change it: public override int WordCount() { return base.WordCount() + ExecutiveSummaryWordCount(); }.
Hmm, I wanted to override ToString() - however this cannot be made virtual ... – BlueButtons Sep 24 at 9:16 @BlueButtons - it is already virtual; the code you posted (TextFile) compiles fine. Please show the code that doesn't work. – Marc Gravell?
Sep 24 at 9:27.
Nah, I found my error. Thanks for the respone :o) – BlueButtons Sep 24 at 9:17.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.