private bool IsFix(TypeDescriptor inType, out FixFormat format)
 {
     if (inType.CILType.Equals(typeof(SFix)) ||
         inType.CILType.Equals(typeof(UFix)))
     {
         format = inType.GetFixFormat();
         return true;
     }
     format = null;
     return false;
 }
 private TypeDescriptor GetNearestType(IEnumerable<TypeDescriptor> types, TypeDescriptor type)
 {
     var candidates = types.Where(t => t.CILType.Equals(type.CILType));
     if (type.CILType.Equals(typeof(SFix)) ||
         type.CILType.Equals(typeof(UFix)) ||
         type.CILType.Equals(typeof(Signed)) ||
         type.CILType.Equals(typeof(Unsigned)))
     {
         var fmt = type.GetFixFormat();
         candidates = candidates.OrderBy(t =>
             Math.Abs(t.GetFixFormat().IntWidth - fmt.IntWidth));
         candidates = candidates.OrderBy(t =>
             Math.Abs(t.GetFixFormat().FracWidth - fmt.FracWidth));
     }
     var result = candidates.FirstOrDefault();
     if (result == null)
         result = types.FirstOrDefault();
     return result;
 }