473,396 Members | 2,002 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,396 software developers and data experts.

Arbitrary association of objects

I'm working on a (non-trivial) project which includes various & numerous
objects, some in my direct source control, some not.

I'm finding the need to somehow associate one object with another, somewhat
arbitrarily. The previous implementation (in C++) used external maps that
would create a 'link' between these objects. Needless to say, this was the
source of many problems due to the maintenance requirements of the links as
objects came and went.

My preference is now to create a definition that objects (specifically classes)
can derive from which would would allow for 'associations', something like:

class Associable
{
public void Associate(string key, object o);
public void Dissociate(string key);
public object Retrieve(string key);
// Other stuff omitted
};

Now, I can create an association between objects, at will, at runtime,
whenever.

Nothing too exciting, but I've been living in a cave for the last 3 years, so I
don't know if there has been any meaningful discussion of such a paradigm, and
the benefits/caveats of such. Anyone have any insights, references, etc.?

Thanks

--
Bret Pehrson
mailto:br**@infowest.com
NOSPAM - Include this key in all e-mail correspondence <<38952rglkwdsl>>
Nov 15 '05 #1
3 1551
Bret,
Your Associable class looks similar to a Hashtable or Dictionary. Search
for them in MSDN and check if they fit your needs.

--------------------
Message-ID: <40***************@infowest.com>
From: Bret Pehrson <br**@infowest.com>
X-Mailer: Mozilla 4.8 [en] (Windows NT 5.0; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: microsoft.public.dotnet.languages.csharp
Subject: Arbitrary association of objects
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 33
Date: Thu, 29 Jan 2004 12:57:52 -0800
NNTP-Posting-Host: 68.108.95.144
X-Complaints-To: ab***@cox.net
X-Trace: fed1read07 1075409850 68.108.95.144 (Thu, 29 Jan 2004 15:57:30 EST)NNTP-Posting-Date: Thu, 29 Jan 2004 15:57:30 EST
Organization: Cox Communications
Path: cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTN GP08.phx.gbl!newsfeed00.su
l.t-online.de!t-online.de!130.59.10.21.MISMATCH!irazu.switch.ch!sw itch.ch!ec
ngs!feeder.ecngs.de!peer02.cox.net!cox.net!p01!fed 1read07.POSTED!not-for-mai
lXref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.languages.csharp:216472
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

I'm working on a (non-trivial) project which includes various & numerous
objects, some in my direct source control, some not.

I'm finding the need to somehow associate one object with another, somewhat
arbitrarily. The previous implementation (in C++) used external maps that
would create a 'link' between these objects. Needless to say, this was the
source of many problems due to the maintenance requirements of the links as
objects came and went.

My preference is now to create a definition that objects (specifically classes)can derive from which would would allow for 'associations', something like:

class Associable
{
public void Associate(string key, object o);
public void Dissociate(string key);
public object Retrieve(string key);
// Other stuff omitted
};

Now, I can create an association between objects, at will, at runtime,
whenever.

Nothing too exciting, but I've been living in a cave for the last 3 years, so Idon't know if there has been any meaningful discussion of such a paradigm, andthe benefits/caveats of such. Anyone have any insights, references, etc.?

Thanks

--
Bret Pehrson
mailto:br**@infowest.com
NOSPAM - Include this key in all e-mail correspondence <<38952rglkwdsl>>

Rakesh, EFT.

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Nov 15 '05 #2

Hi Bret,

Thank you for posting in the community!

Based on my understanding, you want to associate different types of objects
together in C#

========================================
Just as Rakesh said, you should refer to the classes in System.Collections
namespace. Such as HashTable, ArrayList, etc..

Some of these classes enable you to use key-and-value pairs to store
diffrent type of objects.

Please refer to:
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemcollections.asp

========================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 15 '05 #3

Hi Bret,

Is your problem resolved?
If you still have any concern, please feel free to tell me, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 15 '05 #4

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

Similar topics

2
by: roadster | last post by:
Hi, I'm new to C++ and I don't know how I can implement an association between two objects. e.g. we have objects A and B. B has the following interface-function : GetInfo() From within a...
2
by: David | last post by:
Hi, I am trying to create a two way association between 2 objects. I intended to do it by having a pointer to each other but I am getting compilation errors. At the moment I can create both...
8
by: Steve Neill | last post by:
Can anyone suggest how to create an arbitrary object at runtime WITHOUT using the deprecated eval() function. The eval() method works ok (see below), but is not ideal. function Client() { }...
6
by: Nak | last post by:
Hi there, I am implementing file association from within my application, association that occurs after installation. Anyway, I remember a while back seeing a key in the registry that was used...
4
by: Russell Warren | last post by:
I've got a case where I want to convert binary blocks of data (various ctypes objects) to base64 strings. The conversion calls in the base64 module expect strings as input, so right now I'm...
28
by: walterbyrd | last post by:
Python seems to have a log of ways to do collections of arbitrary objects: lists, tuples, dictionaries. But what if I want a collection of non-arbitrary objects? A list of records, or something...
5
by: =?Utf-8?B?RG91Z0U=?= | last post by:
I am at my wits end. VB .net is supposed to be an object oriented language. But I have tried hack after hack, and I can not get past either "Reference to a non-shared member requires an object...
1
by: CatchSandeepVaid | last post by:
I have posted this question in hibernate forums also.. As this forum is related to java, i am posting it here also ... In hibernate, presently one-to-one associations are fetched non-lazily... I...
0
by: AlarV | last post by:
Hello again everyone! I'm creating a project in Java for a university lesson, by using UML Diagrams. To generally give you an idea of the project, I have to create a Property Office, that has as...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
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...
0
tracyyun
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...

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.