I'm trying to replicate the behaviour of the Commerce.Dictio nary object that
was found in Commerce Server 3.0
By using a hashtable or creating a custom class that implements IDictionary,
you have to add elements by using the following syntax.
DictionaryObjec t.Add("key","va lue");
However, the old Commerce Server Dictionary object used the following
syntax.
DictionaryObjec t.Name = "Fred"
In this instance, the dictionary object creates a new element key called
"Name" and assigns the value of "Fred" to it.
Any thoughts on how to replicate this? 15 7940
What are probably looking to do is create a Dictionary Object and then a
Collection of Dictionary Object, so more like
Public class MyDictObj
{
// has member name
}
public class CMyDictObj : CollectionBase
{
// represents collection of MyDictObj
}
HTH
VJ
"Dave Young" <da************ ***@softwarespe ctrum.comwrote in message
news:OB******** ******@TK2MSFTN GP02.phx.gbl...
I'm trying to replicate the behaviour of the Commerce.Dictio nary object
that was found in Commerce Server 3.0
By using a hashtable or creating a custom class that implements
IDictionary, you have to add elements by using the following syntax.
DictionaryObjec t.Add("key","va lue");
However, the old Commerce Server Dictionary object used the following
syntax.
DictionaryObjec t.Name = "Fred"
In this instance, the dictionary object creates a new element key called
"Name" and assigns the value of "Fred" to it.
Any thoughts on how to replicate this?
It's not perfect, but you could use an indexer to reduce the amount of
modification.
private Dictionary<stri ng, stringhash = new Dictionary<stri ng, string>();
public string this[string key]
{
get
{
return hash[key];
}
set
{
hash[key] = value;
}
}
Which means that instead of:
DictionaryObjec t.Name = "Fred"
you do:
DictionaryObjec t["Name"] = "Fred";
I think it's not possible to dynamically create properties as C# is a
statically typed language and you will get a compiler error if the property
you are asking for does not exist.
If you REALLY want it to work like this and don't care about bloat you could
write a codeGen to create a class file with every single alphabetical
combination created as a property.
As an example of A:
public string A
{
get
{
return hash["A"];
}
set
{
hash["A"] = value;
}
}
But that would be a seriously LONG file.
HTH
Simon
"Dave Young" <da************ ***@softwarespe ctrum.comwrote in message
news:OB******** ******@TK2MSFTN GP02.phx.gbl...
I'm trying to replicate the behaviour of the Commerce.Dictio nary object
that
was found in Commerce Server 3.0
By using a hashtable or creating a custom class that implements
IDictionary,
you have to add elements by using the following syntax.
DictionaryObjec t.Add("key","va lue");
However, the old Commerce Server Dictionary object used the following
syntax.
DictionaryObjec t.Name = "Fred"
In this instance, the dictionary object creates a new element key called
"Name" and assigns the value of "Fred" to it.
Any thoughts on how to replicate this?
I don't really understand the point.
Can't you just use a database?
Is SQL Server more complex than this?
-Todos
On Mar 13, 11:16 am, "Dave Young"
<dave.young.nos ...@softwarespe ctrum.comwrote:
I'm trying to replicate the behaviour of the Commerce.Dictio nary object that
was found in Commerce Server 3.0
By using a hashtable or creating a custom class that implements IDictionary,
you have to add elements by using the following syntax.
DictionaryObjec t.Add("key","va lue");
However, the old Commerce Server Dictionary object used the following
syntax.
DictionaryObjec t.Name = "Fred"
In this instance, the dictionary object creates a new element key called
"Name" and assigns the value of "Fred" to it.
Any thoughts on how to replicate this?
I believe that the OP is asking about an in-memory data structure, not
a long-term storage option.
On Mar 13, 1:49 pm, "Todos Menos [MSFT]"
<todos_menos_m. ..@hotmail.comw rote:
I don't really understand the point.
Can't you just use a database?
Is SQL Server more complex than this?
-Todos
On Mar 13, 11:16 am, "Dave Young"
<dave.young.nos ...@softwarespe ctrum.comwrote:
I'm trying to replicate the behaviour of the Commerce.Dictio nary object that
was found in Commerce Server 3.0
By using a hashtable or creating a custom class that implements IDictionary,
you have to add elements by using the following syntax.
DictionaryObjec t.Add("key","va lue");
However, the old Commerce Server Dictionary object used the following
syntax.
DictionaryObjec t.Name = "Fred"
In this instance, the dictionary object creates a new element key called
"Name" and assigns the value of "Fred" to it.
Any thoughts on how to replicate this?
I "think" he's trying to prop up existing code by re-writing this library.
If the API changes then more code needs to be re-written.
That's why I think he's not using a database.
I could be wrong though, if that's the case then you're right a database is
definately the best course of action. Because trying to create a dynamic
type in a statically typed language is like putting a square peg in a round
hole.
"Todos Menos [MSFT]" <to************ **@hotmail.comw rote in message
news:11******** *************@b 75g2000hsg.goog legroups.com...
I don't really understand the point.
Can't you just use a database?
Is SQL Server more complex than this?
-Todos
On Mar 13, 11:16 am, "Dave Young"
<dave.young.nos ...@softwarespe ctrum.comwrote:
I'm trying to replicate the behaviour of the Commerce.Dictio nary object
that
was found in Commerce Server 3.0
By using a hashtable or creating a custom class that implements
IDictionary,
you have to add elements by using the following syntax.
DictionaryObjec t.Add("key","va lue");
However, the old Commerce Server Dictionary object used the following
syntax.
DictionaryObjec t.Name = "Fred"
In this instance, the dictionary object creates a new element key called
"Name" and assigns the value of "Fred" to it.
Any thoughts on how to replicate this?
Simon Tamman <i_************ *************** *******@NOSPAMh otmail.com>
wrote:
I "think" he's trying to prop up existing code by re-writing this library.
If the API changes then more code needs to be re-written.
That's why I think he's not using a database.
I could be wrong though, if that's the case then you're right a database is
definately the best course of action. Because trying to create a dynamic
type in a statically typed language is like putting a square peg in a round
hole.
"Todos" isn't trying to make serious points - he's just trolling. Best
to ignore.
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Thanks for the tip. :D
No chance I could get your opinion on my wierd bug I posted yesterday is
there?
I did include a "short but complete" example to demonstrate the problem. :D
"Jon Skeet [C# MVP]" <sk***@pobox.co mwrote in message
news:MP******** *************** *@msnews.micros oft.com...
Simon Tamman <i_************ *************** *******@NOSPAMh otmail.com>
wrote:
I "think" he's trying to prop up existing code by re-writing this
library.
If the API changes then more code needs to be re-written.
That's why I think he's not using a database.
I could be wrong though, if that's the case then you're right a database
is
definately the best course of action. Because trying to create a dynamic
type in a statically typed language is like putting a square peg in a
round
hole.
"Todos" isn't trying to make serious points - he's just trolling. Best
to ignore.
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
I just think that we should be teaching these Newbies about DATABASES
and not all this ADO.net and XML _CRAP_
that is why we outsource all this crap to india-- because there aren't
enough kids in the good old USA that know how to speak SQL
On Mar 13, 2:00 pm, "Bruce Wood" <brucew...@cana da.comwrote:
I believe that the OP is asking about an in-memory data structure, not
a long-term storage option.
On Mar 13, 1:49 pm, "Todos Menos[MSFT]"
<todos_menos_m. ..@hotmail.comw rote:
I don't really understand the point.
Can't you just use a database?
Is SQL Server more complex than this?
-Todos
On Mar 13, 11:16 am, "Dave Young"
<dave.young.nos ...@softwarespe ctrum.comwrote:
I'm trying to replicate the behaviour of the Commerce.Dictio nary object that
was found in Commerce Server 3.0
By using a hashtable or creating a custom class that implements IDictionary,
you have to add elements by using the following syntax.
DictionaryObjec t.Add("key","va lue");
However, the old Commerce Server Dictionary object used the following
syntax.
DictionaryObjec t.Name = "Fred"
In this instance, the dictionary object creates a new element key called
"Name" and assigns the value of "Fred" to it.
Any thoughts on how to replicate this?- Hide quoted text -
- Show quoted text -
Simon Tamman <i_************ *************** *******@NOSPAMh otmail.com>
wrote:
Thanks for the tip. :D
No chance I could get your opinion on my wierd bug I posted yesterday is
there?
I did include a "short but complete" example to demonstrate the problem. :D
Unfortunately I don't know a lot about the details of Windows Forms.
Have you asked in the Windows Forms newsgroup?
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: boohoo |
last post by:
I can't seem to do this:
I want to take a query string and place two halves of the querystring
into two separate dictionary objects.
So... I loop through the collection of querystring items, right?
When I get to a certain item in the querystring, all items after that
are to be put into the SECOND dictionary object.
|
by: orekinbck |
last post by:
Hi There
I am probably missing something fundamental here, but I cannot see a
method to search the values of a generic dictionary so that I can find
the key ? Of course I could enumerate through the Values collection
but that seems a little long winded.
I ended up using a sorted list because it has the IndexOfValue method.
However I don't need the sorting.
|
by: jg |
last post by:
I was trying to get custom dictionary class that can store generic or
string; So I started with the example given by the visual studio 2005 c#
online help for simpledictionay object
That seem to miss a few things including #endregion directive and the ending
class }
Is there not a simple way like in dotnet vb?
I managed to get the sample to code to this:
|
by: Martin Widmer |
last post by:
Hi Folks.
When I iterate through my custom designed collection, I always get the
error:
"Unable to cast object of type 'System.Collections.DictionaryEntry' to type
'ContentObjects.ContentBlock'."
The error occurs at the "For...Each" line if this method:
|
by: Girish Sahani |
last post by:
I wrote the following code to concatenate every 2 keys of a dictionary and
their corresponding values.
e.g if i have tiDict1 = tiDict1 = {'a':,'b':} i should get
tiDict2={'ab':} and similarly for dicts with larger no. of
features.
Now i want to check each pair to see if they are connected...element of
this pair will be one from the first list and one from the second....e.g
for 'ab' i want to check if 1 and 3 are connected,then 1 and...
| |
by: titan.nyquist |
last post by:
Is there a typical way to create a dictionary (or hash table) with two
values, instead of one?
Currently, my data structure is TWO dictionaries, each with matching
and fully sychronized keys. This allows me to have one key with two
values (one value in each dictionary). This is ugly code as the
dictionaries could get out of synch (due to a bug or something).
Titan
|
by: csharpula csharp |
last post by:
Hello,
I was wondering if there is a way in c# to append two Dictionaries of
the same type:
Dictionary<string,objectdic1 and Dictionary<string,objectdic2 into
one new Dictionary<string,object?
(Is there any kind of AddRange such as exisits in generic list)?
Thank you very much!
|
by: mmm |
last post by:
I found code to undo a dictionary association.
def undict(dd, name_space=globals()):
for key, value in dd.items():
exec "%s = %s" % (key, repr(value)) in name_space
So if i run
I get
|
by: =?Utf-8?B?THVpZ2k=?= |
last post by:
Hi all,
having a dictionary of <int, string(C# 2.0) is there a way to retrieve the
key for a specific value (of type string)?
Obviously I populate the Dictionary with not duplicated strings.
Thanks a lot.
--
Luigi
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |