<?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>Generic Parse method on Enum - a solution</title><link>http://weblogs.asp.net/wim/archive/2006/07/06/Generic-Parse-method-on-Enum-_2D00_-a-solution.aspx</link><description>David Findley writes about how he wishes we had a generic Parse method on the Enum class in .NET 2.0. Though I agree in principle, it's actually quite trivial to create a generic static class with a Parse method, which alleviates some of the pain. Here</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>re: Generic Parse method on Enum - a solution</title><link>http://weblogs.asp.net/wim/archive/2006/07/06/Generic-Parse-method-on-Enum-_2D00_-a-solution.aspx#7255440</link><pubDate>Sun, 15 Nov 2009 12:10:05 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7255440</guid><dc:creator>poori</dc:creator><author>poori</author><description>&lt;p&gt;I just got an iphone 3g and I got so excited that i filled it with loads of applications and songs (about $30 worth). The other day when i plugged my &amp;lt;a href=&amp;quot;&lt;a rel="nofollow" target="_new" href="http://unlockiphone22.com/&amp;quot;&amp;gt;www.unlockiphone22.com&amp;lt;/a&amp;gt;"&gt;unlockiphone22.com/.../a&amp;gt;&lt;/a&gt; &amp;nbsp;into the computer on itunes it said to reset the iphone to factory settings. I dont want to loose all my apps so what can i do? PLEASE REPLY A.S.A.P.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7255440" width="1" height="1"&gt;</description></item><item><title>re: Generic Parse method on Enum - a solution</title><link>http://weblogs.asp.net/wim/archive/2006/07/06/Generic-Parse-method-on-Enum-_2D00_-a-solution.aspx#7229581</link><pubDate>Wed, 14 Oct 2009 09:28:39 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7229581</guid><dc:creator>poori</dc:creator><author>poori</author><description>&lt;p&gt;I hear that term &amp;quot;jail broken&amp;quot; all the time when talking to friends but i never understood what it meant. I want to say that if you buy a jail broken iphone you don't have to pay for the data usage plan. Is that true? What exactly does it mean jail broken and what is its functions? Thanks.&lt;/p&gt;
&lt;p&gt;________________&lt;/p&gt;
&lt;p&gt; &amp;lt;a href=&amp;quot;&lt;a rel="nofollow" target="_new" href="http://www.youtube.com/watch?v=EpZmDnMZahc&amp;quot;&amp;gt;unlock"&gt;www.youtube.com/watch&lt;/a&gt; iphone 3gs&amp;lt;/a&amp;gt; &lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7229581" width="1" height="1"&gt;</description></item><item><title>re: Generic Parse method on Enum - a solution</title><link>http://weblogs.asp.net/wim/archive/2006/07/06/Generic-Parse-method-on-Enum-_2D00_-a-solution.aspx#7090378</link><pubDate>Sat, 16 May 2009 12:54:25 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7090378</guid><dc:creator>nick_rodome</dc:creator><author>nick_rodome</author><description>&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://www.message_c4tacacricpa.com/"&gt;www.message_c4tacacricpa.com&lt;/a&gt;&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7090378" width="1" height="1"&gt;</description></item><item><title>Developer Tales n&amp;deg;6 - Generic Enum parsing &amp;laquo; Xmlguy Weblog</title><link>http://weblogs.asp.net/wim/archive/2006/07/06/Generic-Parse-method-on-Enum-_2D00_-a-solution.aspx#6767219</link><pubDate>Fri, 05 Dec 2008 15:37:16 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6767219</guid><dc:creator>Developer Tales n°6 - Generic Enum parsing « Xmlguy Weblog</dc:creator><author>Developer Tales n°6 - Generic Enum parsing « Xmlguy Weblog</author><description>&lt;p&gt;Pingback from &amp;nbsp;Developer Tales n&amp;amp;deg;6 - Generic Enum parsing &amp;amp;laquo; Xmlguy Weblog&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6767219" width="1" height="1"&gt;</description></item><item><title>re: Generic Parse method on Enum - a solution</title><link>http://weblogs.asp.net/wim/archive/2006/07/06/Generic-Parse-method-on-Enum-_2D00_-a-solution.aspx#6739945</link><pubDate>Sat, 15 Nov 2008 15:50:10 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6739945</guid><dc:creator>greyson</dc:creator><author>greyson</author><description>&lt;p&gt;public static class GenericEnum&amp;lt;T&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;where T : struct, IComparable, IFormattable, IConvertible&lt;/p&gt;
&lt;p&gt; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;public static bool TryParse(String value)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;bool parsable = false;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (Enum.IsDefined(typeof(T), value))&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;parsable = true;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;return parsable;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;public static T Parse(String value, bool ignoreCase)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;return (T)Enum.Parse(typeof(T), value, ignoreCase);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;public static T Parse(String value)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;return Parse(value, false);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp;}&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6739945" width="1" height="1"&gt;</description></item><item><title>Generic Parse method on Enum - a solution</title><link>http://weblogs.asp.net/wim/archive/2006/07/06/Generic-Parse-method-on-Enum-_2D00_-a-solution.aspx#5342709</link><pubDate>Mon, 26 Nov 2007 19:24:21 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:5342709</guid><dc:creator>Generic Parse method on Enum - a solution</dc:creator><author>Generic Parse method on Enum - a solution</author><description>&lt;p&gt;Pingback from &amp;nbsp;Generic Parse method on Enum - a solution&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=5342709" width="1" height="1"&gt;</description></item><item><title>re: Generic Parse method on Enum - a solution</title><link>http://weblogs.asp.net/wim/archive/2006/07/06/Generic-Parse-method-on-Enum-_2D00_-a-solution.aspx#455725</link><pubDate>Thu, 06 Jul 2006 14:55:09 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:455725</guid><dc:creator>Wim</dc:creator><author>Wim</author><description>&lt;p&gt;Jouni - you're right, unless you got a good reason for having a generic util class, it makes more sense just having a static generic method.&lt;/p&gt;
&lt;p&gt;David - nice one, your generic TryParse() function. Not sure whether it'd be better to raise an exception or return a boolean if teh value cannot be parsed but hey...&lt;/p&gt;
&lt;p&gt;Dave - yep, it would make a lot of sense, and in many cases they have not really looked at existing classes in the framework and said:&amp;quot;Now, where would it be useful to add generics into the mix...&amp;quot;, even if they'd limited that to the System namespace...&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=455725" width="1" height="1"&gt;</description></item><item><title>re: Generic Parse method on Enum - a solution</title><link>http://weblogs.asp.net/wim/archive/2006/07/06/Generic-Parse-method-on-Enum-_2D00_-a-solution.aspx#455721</link><pubDate>Thu, 06 Jul 2006 13:38:48 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:455721</guid><dc:creator>findleyd</dc:creator><author>findleyd</author><description>&lt;p&gt;I'm actually doing this at the moment. Thats how I came up with the idea of Hey, why don't they just do this on the Enum class so millions of developers won't have to go write util code. :)&lt;/p&gt;
&lt;p&gt;Personally I think MS was very conservative with the use of generics in the 2.0 fwk. Once we get to WinFX errr... .NET FWK 3.0 I think the use of gerics will explode. I just hope they remember to give the enum class some love. :P&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=455721" width="1" height="1"&gt;</description></item><item><title>re: Generic Parse method on Enum - a solution</title><link>http://weblogs.asp.net/wim/archive/2006/07/06/Generic-Parse-method-on-Enum-_2D00_-a-solution.aspx#455720</link><pubDate>Thu, 06 Jul 2006 13:36:29 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:455720</guid><dc:creator>David Truxall</dc:creator><author>David Truxall</author><description>&lt;p&gt;I posted a TryParse style function for enums on my blog at &lt;a rel="nofollow" target="_new" href="http://dotnetjunkies.com/WebLog/davetrux/archive/2005/12/07/134190.aspx"&gt;http://dotnetjunkies.com/WebLog/davetrux/archive/2005/12/07/134190.aspx&lt;/a&gt;&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=455720" width="1" height="1"&gt;</description></item><item><title>re: Generic Parse method on Enum - a solution</title><link>http://weblogs.asp.net/wim/archive/2006/07/06/Generic-Parse-method-on-Enum-_2D00_-a-solution.aspx#455713</link><pubDate>Thu, 06 Jul 2006 11:58:52 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:455713</guid><dc:creator>Jouni Heikniemi</dc:creator><author>Jouni Heikniemi</author><description>&lt;p&gt;It would probably make more sense to use the type parameter at the method level (i.e. public static T Parse&amp;lt;T&amp;gt;(string s)) instead of the class level. &lt;/p&gt;
&lt;p&gt;Having a type-parameterized utility class may be useful in some particular context, but unless it's instantiated for some purposes (such as to wrap or manage the instances of the original class/enum), I'd vote for keeping the type parameterization at the static method level.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=455713" width="1" height="1"&gt;</description></item></channel></rss>