本文整理匯總了C#中System.Globalization.ThaiBuddhistCalendar.AlgorithmType屬性的典型用法代碼示例。如果您正苦於以下問題:C# ThaiBuddhistCalendar.AlgorithmType屬性的具體用法?C# ThaiBuddhistCalendar.AlgorithmType怎麽用?C# ThaiBuddhistCalendar.AlgorithmType使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。
在下文中一共展示了ThaiBuddhistCalendar.AlgorithmType屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Main
//引入命名空間
using System;
using System.Collections;
using System.Globalization;
using System.Reflection;
public class Example
{
public static void Main()
{
Assembly assem = Assembly.GetAssembly(typeof(Calendar));
Type[] types = assem.GetExportedTypes();
Type[] calendars = Array.FindAll(types, IsValidCalendar);
Array.Sort(calendars, new CalendarComparer());
Console.WriteLine("{0,-30} {1}\n", "Calendar", "Algorithm Type");
foreach (var cal in calendars) {
// Instantiate a calendar object.
ConstructorInfo ctor = cal.GetConstructor( new Type[] {} );
Calendar calObj = (Calendar) ctor.Invoke( new Type[] {} );
Console.WriteLine("{0,-30} {1}",
cal.ToString().Replace("System.Globalization.", ""),
cal.InvokeMember("AlgorithmType",
BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty,
null, calObj, null));
}
}
private static bool IsValidCalendar(Type t)
{
if (t.IsSubclassOf(typeof(Calendar)))
if (t.IsAbstract)
return false;
else
return true;
else
return false;
}
}
public class CalendarComparer : IComparer
{
public int Compare(object x, object y)
{
Type tX = (Type) x;
Type tY = (Type) y;
return tX.Name.CompareTo(tY.Name);
}
}
輸出:
Calendar Algorithm Type ChineseLunisolarCalendar LunisolarCalendar GregorianCalendar SolarCalendar HebrewCalendar LunisolarCalendar HijriCalendar LunarCalendar JapaneseCalendar SolarCalendar JapaneseLunisolarCalendar LunisolarCalendar JulianCalendar SolarCalendar KoreanCalendar SolarCalendar KoreanLunisolarCalendar LunisolarCalendar PersianCalendar SolarCalendar TaiwanCalendar SolarCalendar TaiwanLunisolarCalendar LunisolarCalendar ThaiBuddhistCalendar SolarCalendar UmAlQuraCalendar LunarCalendar