<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Getting a list of constants using Reflection</title><link>http://weblogs.asp.net/whaggard/archive/2003/02/20/2708.aspx</link><description>Thanks to Drew Marsh I was able to create a function to get a list of the constants for a particular type in c#. There were two key things I was missing: BindingFlags.FlattenHierarchy Specifies that static members up the hierarchy should be returned.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>re: Getting a list of constants using Reflection</title><link>http://weblogs.asp.net/whaggard/archive/2003/02/20/2708.aspx#7267982</link><pubDate>Tue, 01 Dec 2009 18:26:55 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7267982</guid><dc:creator>mkamoski</dc:creator><author>mkamoski</author><description>&lt;p&gt;Thank you very much for the starting point. I refactored the code a bit to make it static, and to allow one to get values, and etc. The link is as follows... &lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://mkamoski1.wordpress.com/2009/12/01/reflection-for-information-on-constants/"&gt;mkamoski1.wordpress.com/.../reflection-for-information-on-constants&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;...so I HTH.&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;
&lt;p&gt;-- Mark Kamoski&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7267982" width="1" height="1"&gt;</description></item><item><title>Reflection For Information On Constants &amp;laquo; Mark Kamoski&amp;#039;s Blog</title><link>http://weblogs.asp.net/whaggard/archive/2003/02/20/2708.aspx#7267981</link><pubDate>Tue, 01 Dec 2009 18:24:46 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7267981</guid><dc:creator>Reflection For Information On Constants « Mark Kamoski's Blog</dc:creator><author>Reflection For Information On Constants « Mark Kamoski's Blog</author><description>&lt;p&gt;Pingback from &amp;nbsp;Reflection For Information On Constants &amp;amp;laquo; Mark Kamoski&amp;amp;#039;s Blog&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7267981" width="1" height="1"&gt;</description></item><item><title>re: Getting a list of constants using Reflection</title><link>http://weblogs.asp.net/whaggard/archive/2003/02/20/2708.aspx#7267918</link><pubDate>Tue, 01 Dec 2009 16:34:09 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7267918</guid><dc:creator>mkamoski</dc:creator><author>mkamoski</author><description>&lt;p&gt;Do you have an answer for this question... &amp;quot;When using fi.GetValue(null), I just get the constant name? Any ideas?&amp;quot;???&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7267918" width="1" height="1"&gt;</description></item><item><title>re: Getting a list of constants using Reflection</title><link>http://weblogs.asp.net/whaggard/archive/2003/02/20/2708.aspx#7267868</link><pubDate>Tue, 01 Dec 2009 14:52:12 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7267868</guid><dc:creator>mkamoski</dc:creator><author>mkamoski</author><description>&lt;p&gt;Are there any issues with making this a static method in a static class?&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7267868" width="1" height="1"&gt;</description></item><item><title>re: Getting a list of constants using Reflection</title><link>http://weblogs.asp.net/whaggard/archive/2003/02/20/2708.aspx#7213494</link><pubDate>Mon, 21 Sep 2009 20:45:24 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7213494</guid><dc:creator>Dennis Webb</dc:creator><author>Dennis Webb</author><description>&lt;p&gt;You rock, This helped me out a lot.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7213494" width="1" height="1"&gt;</description></item><item><title>re: Getting a list of constants using Reflection</title><link>http://weblogs.asp.net/whaggard/archive/2003/02/20/2708.aspx#59509</link><pubDate>Fri, 16 Jan 2004 21:13:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:59509</guid><dc:creator>mick</dc:creator><author>mick</author><description>When using fi.GetValue(null), I just get the constant name? Any ideas?&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=59509" width="1" height="1"&gt;</description></item><item><title>re: Getting a list of constants using Reflection</title><link>http://weblogs.asp.net/whaggard/archive/2003/02/20/2708.aspx#14568</link><pubDate>Wed, 14 May 2003 08:35:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:14568</guid><dc:creator>Wes Haggard</dc:creator><author>Wes Haggard</author><description>Yes in the for loop above you can just say fi.GetValue(null); and it will return the value of that constant as an object.
&lt;br&gt;

&lt;br&gt;
HTH
&lt;br&gt;
Wes&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=14568" width="1" height="1"&gt;</description></item><item><title>re: Getting a list of constants using Reflection</title><link>http://weblogs.asp.net/whaggard/archive/2003/02/20/2708.aspx#14551</link><pubDate>Wed, 14 May 2003 05:21:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:14551</guid><dc:creator>Clayton</dc:creator><author>Clayton</author><description>I was hoping to access the values of the constants. Do you now how to do this?&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=14551" width="1" height="1"&gt;</description></item></channel></rss>