write c# implementation of abstract class inline?
abstract-class, android, c#, mono
Solution
C# doesn't support inline classes as in Java. You could define anonymous methods but not entire classes. So you will have to define a separate class that implements the abstract class.
Problem
I found a great example of code written in java for the use of a timer / timertask classes... I am currently turning this into c# for a 'Mono for Android' implementation, but having trouble with converting the inline implementation of the abstract class TimerTask ``` // Here's the original java code private void resetMapChangeTimer() { mChangeDelayTimer.schedule( new TimerTask() { @Override public void run() { // Some code to run } }, longTenSeconds); } ``` When I implement this in c#, I would like to create an inherited class from TimerTask (abstract class) and the run method etc in-line without having to create a seperate class (extending TimerTask) as the java code above does. Can anyone advise me on the c# syntax to create this abstract class inline instead of creating a seperate class just to inherit and implement TimerTask?