My understanding of the BCL guidelines was that hashtables/dictionaries should 
throw when the item is not present.  The .NET Framework 1.0 design (which 
returned null, not throw) was deemed inferior.  I don't maintain DTF but the 
"optimized pattern" for your scenario was to use the "bool TryXxx(out value)" 
pattern.  Does DTF have that?

-----Original Message-----
From: vexilar [mailto:s...@sorna.com]
Sent: Tuesday, January 20, 2009 12:19
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] Expected behavior of customActionData["nonExistentKey"]


I ended up writing a method to obtain values from CustomActionData instances:

 private static string getCustomActionDataValue(CustomActionData
customActionData, string key)
        {
            try
            {
                return customActionData[key];
            }
            catch
            {
                return String.Empty;
            }
        }

So that when I want to do something based on whether key in customActionData
is populated or not I can just say

if (getCustomActionDataValue(customActionData, "key") != "") { doSomething;
}

I modeled this after how session["nonExistentKey"] works.  Is there a reason
why customActionData["nonExistentKey"] doesn't work this way (instead it
throws an exception)?
--
View this message in context: 
http://n2.nabble.com/Expected-behavior-of-customActionData-%22nonExistentKey%22--tp2188585p2188585.html
Sent from the wix-users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to