• Create Account

Posted 10 October 2012 - 11:17 AM

I thought I had it with

if (easeFunction.GetType().IsInstanceOfType(typeof(Linear)))

To check if the object was an instance of Linear. Not so.

Still at a loss here.

Here is my delegate declaration

public delegate double EaseDelegate(double start, double end, double duration, double elapsedTime);

And here is the Ease class

public static class Easing
{
public static class Linear
{
public static double EaseNone(double t, double b, double c, double d)
{
return c * t / d + b;
}
public static double EaseIn(double t, double b, double c, double d)
{
return c * t / d + b;
}
public static double EaseOut(double t, double b, double c, double d)
{
return c * t / d + b;
}
public static double EaseInOut(double t, double b, double c, double d)
{
return c * t / d + b;
}
}
}

Now if I pass in Easing.Linear.EaseIn as a "EaseDelegate easeFunction" parameter shouldn't easeFunction be an object? So why I can't I use "if(easeFunction is Linear)". I get "the expression is never of the provided type". I get the same if I use "if(easeFunction is Easing)".

if (easeFunction.GetType().IsInstanceOfType(typeof(Linear)))