/// <summary>
/// 出生月份
/// 出生日期
/// </summary>
/// <returns>星座</returns>
public static Func<int, int, string> GetConstellation()
{
return (x, y) =>
{
string str = string.Empty;
float birthdayF = x == 1 && y < 20 ?
13 + y / 100f :
x + y / 100f;
float[] bound = { 1.20F, 2.20F, 3.21F, 4.21F, 5.21F, 6.22F, 7.23F, 8.23F, 9.23F, 10.23F, 11.21F, 12.22F, 13.20F };
Constellation[] constellations = new Constellation[12];
for (int i = 0; i < constellations.Length; i++)
constellations[i] = (Constellation)(i + 1);
for (int i = 0; i < bound.Length - 1; i++)
{
float b = bound[i];
float nextB = bound[i + 1];
if (birthdayF >= b && birthdayF < nextB)
str = constellations[i].ToString();
}
return str;
};
}
public enum Constellation
{
水瓶座 = 1, // 1.20 - 2.18
双鱼座 = 2, // 2.19 - 3.20
白羊座 = 3, // 3.21 - 4.19
金牛座 = 4, // 4.20 - 5.20
双子座 = 5, // 5.21 - 6.21
巨蟹座 = 6, // 6.22 - 7.22
狮子座 = 7, // 7.23 - 8.22
处女座 = 8, // 8.23 - 9.22
天秤座 = 9, // 9.23 - 10.23
天蝎座 = 10, // 10.24 - 11.22
射手座 = 11, // 11.23 - 12.21
摩羯座 = 12, // 12.22 - 1.19
}