I know that you cannot override static functions, but for what I'm looking to do, it seems like the logical way to design my class.
I have a method that is associated with my abstract class, that i want to work without the class being instantiated, but will work differently on different implementations of that abstract class(all statically)
Usually when this happens I am overlooking something, or there is a better way to approach the design, so hopefully someone here can set me on the right path.
Essentially I have a Content abstract class something like:
public abstract class Content{
public virtual void copyAll();
public virtual void VerifyContent();
public static virtual Dictionary<int,Content> ProcessAllFromDT(DataTable dt) //Cannot exist
}
And then an implementation of that Ringtone, and Wallpaper
public class Wallpaper:Content{
public void CopyAll(){...}
public void VerifyContent(){...}
//Loads Wallpapers From DT
public static Dictionary<int,Content> ProcessAllFromDT(DataTable dt){...} //content in this case is a wallpaper
}
Finally it would be nice to have something like:
public void ProcessAllContent<T>() where T:Content{
...
var dictionary = T.ProcessAllFromDT(dt); // Doesn't compile.
}
Suggestions on a better design for what I'm trying to do here?
Content
to be instantiable, why not just remove theabstract
keyword?