1>下拉列表
@Html.DropDownList("PayStatus", new List() { new SelectListItem{ Text="未到账", Value ="0"}, new SelectListItem{ Text="已到账", Value ="1"} }, "-- 请选择 --", new { @class = "search_select" })
2>decimal保留两位小数
string.Format("{0:F}",xxxx)
3>yield return
public static class NumberList { public static int[] ints = { 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377 }; public static IEnumerable GetEven() { foreach (int i in ints) if (i % 2 == 0) yield return i; } public static IEnumerable GetOdd() { foreach (int i in ints) if (i % 2 == 1) yield return i; } } static void Main(string[] args) { // 2, 8, 34, 144 Console.WriteLine("Even numbers"); foreach (int i in NumberList.GetEven()) Console.WriteLine(i); //1, 3, 5, 13, 21,55, 89,233, 377 Console.WriteLine("Odd numbers"); foreach (int i in NumberList.GetOdd()) Console.WriteLine(i); Console.ReadKey(); }