/// <summary> /// 返回基於該對象的SugarParameters的數組 /// </summary> /// <param name=""></param> /// <returns></returns> public static SugarParameter[] GetParameter<T>(T Info) where T : class { Type type = typeof(T); object obj = Activator.CreateInstance(type); // 獲取所有屬性。 PropertyInfo[] properties = type.GetProperties(); SugarParameter[] arParms = new SugarParameter[properties.Length]; for (int i = 0; i < properties.Length; i++) { arParms[i] = new SugarParameter($"@{properties[i].Name}", properties[i].GetValue(Info)); } return arParms; }