Silverlight4.0使用反射来遍历枚举

Silverlight4.0使用反射来遍历枚举,第1张

概述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;us

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使用反射来遍历枚举所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1022879.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存