Quote:
Originally Posted by Chaotic42
Thanks for the quick reply. The actual thing I'm dealing with is indeed an interface with two methods and ten properties. Am I crazy or is it weird that I would have to implement all of these things just to add one little String?
Anyway, how do I go through all of these methods and properties and tell C# just to basically let them be?
|
An interface is merely an indication that a class meets certain minimum requirements. It does not provide any code.
In your case your UnmodifiedObject interface, merely states that any class that presents an UnmodifiedObject interface must feature foo1...foo24. It contains no code to do that. The compiler is complaining because you have made your class expose an UnmodifiedObject interface, but you have provided no code to make the interface work.
It sounds like you want to subclass an existing class. In that case you need to find out what the actual type of the class is, and then attempt to subclass it. The easiest way is to run some code where you create an instance of the object of interest, and break into the program with the debugger. Use the debugger to find out the actual type of the object. Once you know that, you can subclass it (provided that the class isn't sealed).
If the class is sealed, or you want to start from scratch, then you will have to create code for each property. (This is where the visual studio code snippets are gold; properties are such a common task that there is a pre-packed snippet ready for creating the property and it's backing field).