public void setAllParameters <TEnum>(float[] paramValue) where TEnum : struct, IConvertible { int paramSize = paramValue.Length, i = 0; if (!typeof(TEnum).IsEnum) { throw new ArgumentException("T must be an enumerated type"); } Array enumArray = EnumUtils.AsArray <TEnum>(); if (enumArray.Length > paramSize) { throw new ArgumentException("Not enough values to fill all the parameter values"); } foreach (TEnum paramaterKey in enumArray) { object key; if (EnumUtils.TryParse(typeof(AnimatorParams), paramaterKey.ToString(), out key)) { if (((AnimatorParams)key).Equals(AnimatorParams.EXPRESSION_INTENSITY) || ((AnimatorParams)key).Equals(AnimatorParams.MOOD_INTENSITY)) { i++; continue; } } setParameter(paramaterKey, paramValue[i++]); } }