using System;
using System.Linq.Expressions;

namespace QC.MMI.MMI_Common;

public class Common
{
	public static bool InArray(string item, string[] items)
	{
		foreach (string text in items)
		{
			if (text == item)
			{
				return true;
			}
		}
		return false;
	}

	public static bool IsTrue(string str)
	{
		str = str.Trim().ToUpper();
		string[] items = new string[3] { "1", "TRUE", "YES" };
		return InArray(str, items);
	}

	public static string GetVarName<T>(Expression<Func<T, T>> exp)
	{
		return ((MemberExpression)exp.Body).Member.Name;
	}
}
