C#: Can a base class use a derived class's variable in a static function?
<p>Is there anyway of having a base class use a derived class's static variable in C#? Something like this:</p>

<pre><code>class Program
{
    static void Main(string[] args)
    {
        int Result = DerivedClass.DoubleNumber();
        Console.WriteLine(Result.ToString());   // Returns 0
    }
}

class BaseClass
{
    public static int MyNumber;

    public static int DoubleNumber()
    {
        return (MyNumber*2);
    }
}

class DerivedClass : BaseClass
{
    public new static int MyNumber = 5;
}
</code></pre>

<p>I'm trying to have it return 10, but I'm getting 0.</p>

<p>Here's where I'm using this: I have a class called ProfilePictures with a static function called GetTempSavePath, which takes a user id as an argument and returns a physical path to the temp file. The path base is a static variable called TempPath. Since I'm using this class in multiple projects and they have different TempPaths, I'm creating a derived class that sets that variable to whatever the path is for the project.</p>

<h3>See Also</h3>

<blockquote>
  <p><a href="http://stackoverflow.com/questions/248263/why-cant-i-declare-c-methods-virtual-and-static">Why can’t I declare C# methods virtual and static?</a></p>
</blockquote>
