473,386 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

adding key/value to Exception.Data & avoiding key conflicts

http://msdn2.microsoft.com/en-us/lib...ta(VS.80).aspx
says:

"Avoid key conflicts by adopting a naming convention to generate
unique keys for key/value pairs. ... two applications, named Products
and Suppliers, each has a method named Sales. The Sales method in the
Products application provides the SKU of a product. The Sales method
in the Suppliers application provides the SID of a supplier. The
naming convention yields the keys, "Products.Sales.SKU" and
"Suppliers.Sales.SID"."

But, how do we get the strings "Products.Sales.SKU" and
"Suppliers.Sales.SID" without hard coding them?

Zytan

Mar 31 '07 #1
1 1896
Zytan,
All they are saying is that you should use unique key values from different
methods / classes when populating the Data property of an Exception object.
It's perfectly OK to hard code the values for the keys, as long as they are
different in each class / method.
They were only making a logical suggestion. You can call your key
"Hamburger" if you like, as long as you don't try to add another "Hamburger"
key to your Exception's Data property somewhere else up the call stack.

Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Zytan" wrote:
http://msdn2.microsoft.com/en-us/lib...ta(VS.80).aspx
says:

"Avoid key conflicts by adopting a naming convention to generate
unique keys for key/value pairs. ... two applications, named Products
and Suppliers, each has a method named Sales. The Sales method in the
Products application provides the SKU of a product. The Sales method
in the Suppliers application provides the SID of a supplier. The
naming convention yields the keys, "Products.Sales.SKU" and
"Suppliers.Sales.SID"."

But, how do we get the strings "Products.Sales.SKU" and
"Suppliers.Sales.SID" without hard coding them?

Zytan

Mar 31 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
by: Victor Bazarov | last post by:
In the project I'm maintaining I've seen two distinct techniques used for returning an object from a function. One is AType function(AType const& arg) { AType retval(arg); // or default...
2
by: laredotornado | last post by:
Hello, I am looking for a cross-browser way (Firefox 1+, IE 5.5+) to have my Javascript function execute from the BODY's "onload" method, but if there is already an onload method defined, I would...
47
by: Pierre Barbier de Reuille | last post by:
Please, note that I am entirely open for every points on this proposal (which I do not dare yet to call PEP). Abstract ======== This proposal suggests to add symbols into Python. Symbols...
8
by: Nathan Sokalski | last post by:
I add a JavaScript event handler to some of my Webcontrols using the Attributes.Add() method as follows: Dim jscode as String = "return (event.keyCode>=65&&event.keyCode<=90);"...
1
by: mitchman10 | last post by:
My Time table has TimeID,Employee,PayPeriod,ChargeCodeID,Hours My Chargecode table has ChargecodeID,c_Text I need an Editable datagrid that will show the TimeID,Employee,PayPeriod,C_Text in a...
0
by: weiwei | last post by:
Hi here is my scenario, I create a drop down list in itemtemplate.(that drop down is created from db), after user click edit command, my ideal plan is have another drop down list in...
0
by: Zytan | last post by:
http://msdn2.microsoft.com/en-us/library/system.exception.data(VS.80).aspx says: "Avoid key conflicts by adopting a naming convention to generate unique keys for key/value pairs. ... two...
0
by: =?Utf-8?B?QW5keSBZdQ==?= | last post by:
Hi, I'm trying to return exceptions from a WCF Service using FaultExceptions. I got the service compiled and running. But I get an error while adding a service reference to it. The error reads: "...
35
by: eliben | last post by:
Python provides a quite good and feature-complete exception handling mechanism for its programmers. This is good. But exceptions, like any complex construct, are difficult to use correctly,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.