<?xml version="1.0" encoding="utf-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>Philip Wolfe - Just the idea guy</title><link>http://www.philipwolfe.com</link><description>.NET Tips, Tricks, Facts, Components, Code, Movies, Thoughts, Rants, etc.</description><language>en-us</language><copyright>Copyright 2007 (c), philipwolfe.com, All Rights Reserved.</copyright><generator>me</generator><image><url>http://www.philipwolfe.com/link.jpg</url><title>Philip Wolfe - Just the idea guy</title><link>http://www.philipwolfe.com/</link><width>88</width><height>31</height></image><item><title>Don't be stupid like HTC</title><description>To download a rom update from their site, I was required to enter my phone's serial number, which didn't work by the way.&amp;nbsp; The textbox that allowed users to enter their serial number wouldn't let you press the Home key or arrow keys...something I was doing often to try to enter the right serial number.&amp;nbsp; So remember, let users press navagation keys on narrowly defined textboxes.&lt;br&gt;&lt;br&gt;http://www.htc.com/www/SupportViewNews.aspx?dl_id=501&amp;amp;news_id=64&lt;br&gt;&lt;br&gt;			 </description><link>http://www.philipwolfe.com/Post.aspx?id=104</link><author>Philip Wolfe &lt;website@philipwolfe.com&gt;</author><pubDate>Wed, 01 Jul 2009 06:00:00 GMT</pubDate><category>Blog</category><guid isPermaLink="true">http://www.philipwolfe.com/Post.aspx?id=104</guid><comments>http://www.philipwolfe.com/Post.aspx?id=104#Feedback</comments><slash:comments>0</slash:comments></item><item><title>Using VS10 Beta 1 (Post 1)</title><description>I downloaded Visual Studio .NET 10 like everyone else yesterday....had good download speeds, so no complaints so far.&amp;nbsp; The installation on my laptop failed at first because I had netfx 1.0 installed and netfx 4.0 wouldn't install.&amp;nbsp; I found the fix on a MSFT blog and got everything installed.&amp;nbsp; At work, the installation went just fine.&amp;nbsp; When I started VS10 up, the splash screen would load but the IDE would not come up.&amp;nbsp; After several trys I was able to get it to work with the safemode switch, so I knew it was an addin problem.&amp;nbsp; I then use the 'log' switch and saw the addins that were being loaded.&amp;nbsp; Seeing the TestDriven.NET addin in the list, I assumed that it wasn't coded for VS10.&amp;nbsp; To remove it, I had to edit the registry and remove the path from this key:&amp;nbsp;HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\AutomationOptions\LookInFolders.&amp;nbsp; Afterthat, VS loaded and in the Help menu I see 3 TestDriven.NET menu entries.&amp;nbsp; Stay tuned for more.&lt;br&gt;&lt;br&gt;Also, I don't like the close buttons on each tab so I sent a feedback about it.&amp;nbsp; Please vote for it!&amp;nbsp;&lt;a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=453791"&gt;https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=453791&lt;/a&gt;</description><link>http://www.philipwolfe.com/Post.aspx?id=102</link><author>Philip Wolfe &lt;website@philipwolfe.com&gt;</author><pubDate>Tue, 19 May 2009 17:00:00 GMT</pubDate><category>Blog</category><guid isPermaLink="true">http://www.philipwolfe.com/Post.aspx?id=102</guid><comments>http://www.philipwolfe.com/Post.aspx?id=102#Feedback</comments><slash:comments>0</slash:comments></item><item><title>TechEd 2009 Presentation</title><description>This presentation was given as an interactive session at TechEd 2009 in LA.&amp;nbsp; In this session I covered how to communicate with state machine workflows that were listening for events through the ExternalDataExchange.&amp;nbsp; The workflow is a simple approval workflow that demonstrates multiple states listening for the same event and one state listening for two events.&lt;br&gt;&lt;br&gt;The three important classes are the MSMQMessageBroker, FileSystemBroker, and DatabaseBroker.&amp;nbsp; These message brokers translate the system events into events that can be consumed by states in the workflow.&lt;br&gt;&lt;br&gt;The event collector is a class that can host multiple "brokers" by loading it as the ExternalDataExchange instead of the specific message brokers.&amp;nbsp; To do this, the base class of the specific message brokers must be changed to the NotifierBase.&lt;br&gt;&lt;br&gt;The WCF project is an example of how to reuse the broker base and communicate with a state machine workflow hosted in WCF which is ultimately an IIS process.&lt;br&gt;&lt;br&gt;I hope to write a paper on this to explain it better.&lt;br&gt;&lt;br&gt;&lt;a href="/attachments/Teched%2009%20State%20Machine%20Demo.zip"&gt;Teched 09 State Machine Demo.zip&lt;/a&gt;&lt;br&gt;			 </description><link>http://www.philipwolfe.com/Post.aspx?id=101</link><author>Philip Wolfe &lt;website@philipwolfe.com&gt;</author><pubDate>Fri, 15 May 2009 16:00:00 GMT</pubDate><category>Presentations</category><guid isPermaLink="true">http://www.philipwolfe.com/Post.aspx?id=101</guid><comments>http://www.philipwolfe.com/Post.aspx?id=101#Feedback</comments><slash:comments>0</slash:comments></item><item><title>WWF Persistence Demo</title><description>&lt;p&gt;I was working through the WWF MSDN forums and saw some questions on the differences between states and statuses and how does persistence and idle work.&amp;nbsp; I decided to get an example together that is illustrates these points without being overly complex.&amp;nbsp; The result was this 1 workflow, 1 code file, and (the best part) self contained SQLExpress database.&lt;br&gt;&lt;br&gt;The example shows how by changing the UnloadOnIdle setting in the config file, the developer can control how a workflow idles and unloads.&amp;nbsp; It also demonstrates how delay activities help transition between states in a state machine workflow and how the timespans are min values, not exact.&amp;nbsp; The delay activities rely on the load interval, another setting that can be controlled with a config file attribute.&amp;nbsp; The final part is the database.&amp;nbsp; This is a SQLExpress database that has all the necessary tables to run a persistence store and is right in the project!&amp;nbsp; When the app runs, it connects to that database without the developer having to attach it to SQL Server.&amp;nbsp; I have also uploaded the database as a seperate zip file to use in your other projects.&lt;br&gt;&lt;br&gt;Enjoy.&lt;br&gt;&lt;br&gt;Attachments:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="/attachments/PersistenceExample.zip"&gt;Persistence Example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/attachments/WFDB.zip"&gt;SQLExpress WWF Database to use as VS.NET a project item&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;</description><link>http://www.philipwolfe.com/Post.aspx?id=100</link><author>Philip Wolfe &lt;website@philipwolfe.com&gt;</author><pubDate>Wed, 18 Jun 2008 06:00:00 GMT</pubDate><category>Blog</category><guid isPermaLink="true">http://www.philipwolfe.com/Post.aspx?id=100</guid><comments>http://www.philipwolfe.com/Post.aspx?id=100#Feedback</comments><slash:comments>0</slash:comments></item><item><title>TechEd Windows Workflow Foundation Presentation</title><description>Attached is the presentation I gave at TechEd this year.&amp;nbsp; It was a heck of a lot of fun to prepare and give this talk on a technology I am very passionate about.&lt;br&gt;&lt;br&gt;Session Description:&lt;br&gt;&lt;strong&gt;More WWF Hosting Options Than You Thought&lt;/strong&gt;&lt;br&gt;Have you ever considered all the possible hosting environments for a Microsoft Windows Workflow?&amp;nbsp; This session will explore different types of hosting, from simple to complex.&amp;nbsp; (Including: simple scenarios such as Console hosted and Service hosted, intermediate scenarios such as Web hosted and asynchronous-Web service hosted, and complex scenarios such as synchronous-Web service hosted and WCF hosted).&amp;nbsp; All of the demos show best practices for hosting in each scenario.&lt;br&gt;&lt;br&gt;&lt;a href="/attachments/TechEd2008 SOA10-TLC.zip"&gt;TechEd2008 SOA10-TLC.zip&lt;/a&gt;</description><link>http://www.philipwolfe.com/Post.aspx?id=99</link><author>Philip Wolfe &lt;website@philipwolfe.com&gt;</author><pubDate>Wed, 11 Jun 2008 06:00:00 GMT</pubDate><category>Presentations</category><guid isPermaLink="true">http://www.philipwolfe.com/Post.aspx?id=99</guid><comments>http://www.philipwolfe.com/Post.aspx?id=99#Feedback</comments><slash:comments>0</slash:comments></item><item><title>A cool string formatting piece of code</title><description>Today I had to come up with a way to format phone numbers from a string containing just the digits.&amp;nbsp; One solution was to just return a bunch of substring calls, but that didn't seem ".NET" enough so I poked around on the net a bit and found this idea.&lt;br&gt;&lt;br&gt;&lt;a href="http://www.thescripts.com/forum/thread361943.html"&gt;http://www.thescripts.com/forum/thread361943.html&lt;/a&gt;&lt;br&gt;&lt;br&gt;The post talks about a class that can format a string by using placeholders with substring parameters.&amp;nbsp; Sounds cool, where's the code?&amp;nbsp; I didn't find the code so I had to come up with it on my own.&amp;nbsp; (See below.)&amp;nbsp; I hope this helps you when you need to format strings.&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;code&gt;&lt;pre&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;using&lt;/span&gt; System;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;using&lt;/span&gt; System.Collections.Generic;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;using&lt;/span&gt; System.Text;

&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;namespace&lt;/span&gt; Utilities
{
	&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;/// &amp;lt;summary&amp;gt;
&lt;/span&gt;	&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;/// This class returns substrings of an argument when used in a call to String.Format
&lt;/span&gt;	&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;/// &amp;lt;/summary&amp;gt;
&lt;/span&gt;	&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;/// &amp;lt;remarks&amp;gt;
&lt;/span&gt;	&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;/// Idea from (http://www.thescripts.com/forum/thread361943.html)
&lt;/span&gt;	&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;/// It will use standard formatter placeholders to generate the string.
&lt;/span&gt;	&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;/// The placeholders are in the form of {0:Sx,y}
&lt;/span&gt;	&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;/// 0 = String.Format argument index
&lt;/span&gt;	&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;/// x = Starting index of the argument
&lt;/span&gt;	&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;/// y = Length desired
&lt;/span&gt;	&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;/// &amp;lt;/remarks&amp;gt;
&lt;/span&gt;	&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;/// &amp;lt;example&amp;gt;
&lt;/span&gt;	&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;/// To format 1234567890 into a phone number: String.Format(new StringFormatter(), "({0:S0,3} {0:S3,3}-{0:S6,4}", "1234567890");
&lt;/span&gt;	&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;/// To format 14AB225 into an inventory location: String.Format(new StringFormatter(), "Item found in Warehouse {0:S0,2}, Room {0:S2,1}, Row {0:S3,1}, Shelf {0:S4,1}, Position {0:S5,2}", "14AB225");
&lt;/span&gt;	&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;/// &amp;lt;/example&amp;gt;
&lt;/span&gt;	&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;class&lt;/span&gt; StringFormatter : IFormatProvider, ICustomFormatter
	{
		&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;///&amp;lt;summary&amp;gt;
&lt;/span&gt;		&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;///Gets an object that provides formatting services for the specified type.
&lt;/span&gt;		&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;///&amp;lt;/summary&amp;gt;
&lt;/span&gt;		&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;///
&lt;/span&gt;		&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;///&amp;lt;returns&amp;gt;
&lt;/span&gt;		&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;///The current instance, if formatType is the same type as the current instance; otherwise, null.
&lt;/span&gt;		&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;///&amp;lt;/returns&amp;gt;
&lt;/span&gt;		&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;///
&lt;/span&gt;		&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;///&amp;lt;param name="formatType"&amp;gt;An object that specifies the type of format object to get. &amp;lt;/param&amp;gt;
&lt;/span&gt;		&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;public&lt;/span&gt; object GetFormat(Type formatType)
		{
			&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;return&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;new&lt;/span&gt; StringFormatter();
		}

		&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;///&amp;lt;summary&amp;gt;
&lt;/span&gt;		&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;///Converts the value of a specified object to an equivalent string representation using specified format and culture-specific formatting information.
&lt;/span&gt;		&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;///&amp;lt;/summary&amp;gt;
&lt;/span&gt;		&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;///
&lt;/span&gt;		&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;///&amp;lt;returns&amp;gt;
&lt;/span&gt;		&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;///The string representation of the value of arg, formatted as specified by format and formatProvider.
&lt;/span&gt;		&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;///&amp;lt;/returns&amp;gt;
&lt;/span&gt;		&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;///
&lt;/span&gt;		&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;///&amp;lt;param name="arg"&amp;gt;An object to format. &amp;lt;/param&amp;gt;
&lt;/span&gt;		&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;///&amp;lt;param name="format"&amp;gt;A format string containing formatting specifications. &amp;lt;/param&amp;gt;
&lt;/span&gt;		&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;///&amp;lt;param name="formatProvider"&amp;gt;An &amp;lt;see cref="T:System.IFormatProvider"&amp;gt;&amp;lt;/see&amp;gt; object that supplies format information about the current instance. &amp;lt;/param&amp;gt;
&lt;/span&gt;		&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;string&lt;/span&gt; Format(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;string&lt;/span&gt; format, object arg, IFormatProvider formatProvider)
		{
			&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;if&lt;/span&gt; (format.StartsWith(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #ededed"&gt;"S"&lt;/span&gt;))
			{
				&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;string&lt;/span&gt;[] parts &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;=&lt;/span&gt; format.Remove(0, 1).Split(',');

				&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;int&lt;/span&gt; start &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;int&lt;/span&gt;.Parse(parts[0]);
				&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;int&lt;/span&gt; length &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;int&lt;/span&gt;.Parse(parts[1]);

				&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;return&lt;/span&gt; ((String)arg).Substring(start, length);
			}

			&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;return&lt;/span&gt; arg.ToString();
		}
	}
}
&lt;/pre&gt;&lt;/code&gt;</description><link>http://www.philipwolfe.com/Post.aspx?id=98</link><author>Philip Wolfe &lt;website@philipwolfe.com&gt;</author><pubDate>Fri, 04 Jan 2008 07:00:00 GMT</pubDate><category>Tips</category><guid isPermaLink="true">http://www.philipwolfe.com/Post.aspx?id=98</guid><comments>http://www.philipwolfe.com/Post.aspx?id=98#Feedback</comments><slash:comments>0</slash:comments></item><item><title>Useful data layer functions</title><description>A friend, Rob, and I wrote these functions today.&amp;nbsp; You may find them helpful when coverting null values from stored procedures or datatables/datarows in your data layer.&lt;br&gt;

&lt;code&gt;
&lt;pre&gt;&lt;span style="color: Green; font-family: Courier New; font-size: 11px; background-color: White"&gt;/// &amp;lt;summary&amp;gt;
/// This method compares value with DBNull.Value and returns null or the value
/// &amp;lt;/summary&amp;gt;
/// &amp;lt;typeparam name="T"&amp;gt;&amp;lt;/typeparam&amp;gt;
/// &amp;lt;param name="value"&amp;gt;&amp;lt;/param&amp;gt;
/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;
&lt;/span&gt;&lt;span style="color: Blue; font-family: Courier New; font-size: 11px; background-color: White"&gt;public&lt;/span&gt; &lt;span style="color: Blue; font-family: Courier New; font-size: 11px; background-color: White"&gt;static&lt;/span&gt; T? GetValueTypeValue&amp;lt;T&amp;gt;(object value) where T : struct
{
	&lt;span style="color: Blue; font-family: Courier New; font-size: 11px; background-color: White"&gt;if&lt;/span&gt; (value == DBNull.Value)
		&lt;span style="color: Blue; font-family: Courier New; font-size: 11px; background-color: White"&gt;return&lt;/span&gt; &lt;span style="color: Blue; font-family: Courier New; font-size: 11px; background-color: White"&gt;null&lt;/span&gt;;
	&lt;span style="color: Blue; font-family: Courier New; font-size: 11px; background-color: White"&gt;else&lt;/span&gt;
		&lt;span style="color: Blue; font-family: Courier New; font-size: 11px; background-color: White"&gt;return&lt;/span&gt; (T)value;
}

&lt;span style="color: Green; font-family: Courier New; font-size: 11px; background-color: White"&gt;/// &amp;lt;summary&amp;gt;
/// This method compares value with DBNull.Value and returns null or the value
/// &amp;lt;/summary&amp;gt;
/// &amp;lt;typeparam name="T"&amp;gt;&amp;lt;/typeparam&amp;gt;
/// &amp;lt;param name="value"&amp;gt;&amp;lt;/param&amp;gt;
/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;
&lt;/span&gt;&lt;span style="color: Blue; font-family: Courier New; font-size: 11px; background-color: White"&gt;public&lt;/span&gt; &lt;span style="color: Blue; font-family: Courier New; font-size: 11px; background-color: White"&gt;static&lt;/span&gt; T GetReferenceTypeValue&amp;lt;T&amp;gt;(object value) where T : &lt;span style="color: Blue; font-family: Courier New; font-size: 11px; background-color: White"&gt;class&lt;/span&gt;
{
	&lt;span style="color: Blue; font-family: Courier New; font-size: 11px; background-color: White"&gt;if&lt;/span&gt; (value == DBNull.Value)
		&lt;span style="color: Blue; font-family: Courier New; font-size: 11px; background-color: White"&gt;return&lt;/span&gt; &lt;span style="color: Blue; font-family: Courier New; font-size: 11px; background-color: White"&gt;null&lt;/span&gt;;
	&lt;span style="color: Blue; font-family: Courier New; font-size: 11px; background-color: White"&gt;else&lt;/span&gt;
		&lt;span style="color: Blue; font-family: Courier New; font-size: 11px; background-color: White"&gt;return&lt;/span&gt; (T)value;
}&lt;/pre&gt;
&lt;/code&gt;</description><link>http://www.philipwolfe.com/Post.aspx?id=97</link><author>Philip Wolfe &lt;website@philipwolfe.com&gt;</author><pubDate>Wed, 02 Jan 2008 21:00:00 GMT</pubDate><category>Tips</category><guid isPermaLink="true">http://www.philipwolfe.com/Post.aspx?id=97</guid><comments>http://www.philipwolfe.com/Post.aspx?id=97#Feedback</comments><slash:comments>0</slash:comments></item></channel></rss>