public Animation getAnim(EventArg eventArg) { Type type = eventArg.GetType(); if (animConstructorDic.ContainsKey(type)) { if (animConstructorDic[type].GetParameters().Length == 0) { return(animConstructorDic[type].Invoke(new object[0]) as Animation); } else if (animConstructorDic[type].GetParameters().Length == 1) { return(animConstructorDic[type].Invoke(new object[] { eventArg }) as Animation); } return(null); } else { return(null); } }