using System;using System.Collections.Generic;using System.linq;using System.Net;using System.windows;using System.windows.Controls;using System.windows.documents;using System.windows.input;using System.windows.Media;using System.windows.Media.Animation;using System.windows.Shapes;using System.Reflection;namespace SilverlightApplication20{ public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); this.Loaded += new RoutedEventHandler(MainPage_Loaded); } voID MainPage_Loaded(object sender,RoutedEventArgs e) { //Silverlight4.0使用反射来遍历枚举 Type enumType = typeof(Days); FIEldInfo[] infos; infos = enumType.GetFIElds(BindingFlags.Public | BindingFlags.Static); foreach (FIEldInfo fi in infos) { MessageBox.Show(fi.name); } } enum Days { Saturday,Sunday,Monday,Tuesday,Wednesday,Thursday,FrIDay } }}总结
以上是内存溢出为你收集整理的Silverlight4.0使用反射来遍历枚举全部内容,希望文章能够帮你解决Silverlight4.0使用反射来遍历枚举所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)