473,695 Members | 2,155 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

aggregation in C#

Hi,

I would like to implement aggregation in C#, therefore I'd need to implement
the queryinterface COM function of a class. I am not sure whether this can
be done, and if yes where to start. If someone has an example, a hint or
anything that might help, please share it with me.

Thanks and Regards,
Jozsi
Nov 17 '05 #1
2 2622
Why do you need to implement a COM interface to do aggregation?

Strict aggregation simply requires the declaration of a public or private
member variable.

If you mean "collection s" then there is a set of collection classes
available already. No need to call COM for that.

On the other hand, if you have a need for a COM app to call your .Net app,
google on ".net COM Interop"

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Jozsef Bekes" <bj****@hotmail .com> wrote in message
news:u6******** ********@tk2msf tngp13.phx.gbl. ..
Hi,

I would like to implement aggregation in C#, therefore I'd need to
implement the queryinterface COM function of a class. I am not sure
whether this can be done, and if yes where to start. If someone has an
example, a hint or anything that might help, please share it with me.

Thanks and Regards,
Jozsi

Nov 17 '05 #2
Hi Nick,

thank you for your answer. Actually I need to rewrite an app in C# that was
written in VB6 and VC++. I need to support old clients connecting to my
converted app via COM, and new clients connecting via .net. The old
architecture (that I am not supposed to change) involves aggregation.
The only way to supoort old clients seems to me to change aggregation to
containment, in other words to derive from the aggregated IF as well, and
implement all the functions in a way that they just forward the call to the
member, however this seems a bit stupid. It does for sure, I have
implemented it :-). If you have a better suggestion, please let me know.

Regards,
Jozsi

"Nick Malik [Microsoft]" <ni*******@hotm ail.nospam.com> wrote in message
news:Y7******** ************@co mcast.com...
Why do you need to implement a COM interface to do aggregation?

Strict aggregation simply requires the declaration of a public or private
member variable.

If you mean "collection s" then there is a set of collection classes
available already. No need to call COM for that.

On the other hand, if you have a need for a COM app to call your .Net app,
google on ".net COM Interop"

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Jozsef Bekes" <bj****@hotmail .com> wrote in message
news:u6******** ********@tk2msf tngp13.phx.gbl. ..
Hi,

I would like to implement aggregation in C#, therefore I'd need to
implement the queryinterface COM function of a class. I am not sure
whether this can be done, and if yes where to start. If someone has an
example, a hint or anything that might help, please share it with me.

Thanks and Regards,
Jozsi


Nov 17 '05 #3

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

Similar topics

1
2912
by: Nice Chap | last post by:
Aggregation in COM was defined as 'Exposing an interface of an inner object by the outer object as though it were an interface of the outer object'. Is this type of aggregation possible in c#? For example... Class COuter - 'Contains' an instance variable of type CInner Class CInner - Implements IList Can COuter be made to look like its implementing IList?
5
3776
by: John Wood | last post by:
Let's say you're provided with an instance of a class. The instantiation takes place in another module that you have no control over. However, you've extended that class with your own value-added functionality. In C#, given such an instance, and a derived class, there's no way to 'attach' the instance to the class -- you have to either change the way the class was instantiated (not possible in this case), or wrap the class and delegate...
4
10962
by: cmrchs | last post by:
Hi, how do I implement aggregation and how composition in C# ? When I say : an Airplane has a Pilot then I use aggregation but when I say : an Airplane has a Cockpit then I use composition. How do I implement the difference in C# ? Here's what I try : class Pilot
4
14444
by: Frederik Vanderhaegen | last post by:
Hi, Can anyone explain me the difference between aggregation and composition? I know that they both are "whole-part" relationships and that composition parts are destroyed when the composition whole is destroyed. Under a "whole-part" relationship I understand the following: the whole can't exists without the parts, but can the parts exist without the hole? f.e.: a car can't exist without an engine private engine _Engine
23
2118
by: SenthilVel | last post by:
Hi Can any one let me know the websites/Pdf for learning Aggragation in C#?? Thanks Senthil
1
2031
by: ninjutsu28 | last post by:
hi im juz a student so pls bear with my terminologies..juz wana ask how to perform aggregation in vb.net code.. in my model, i have rectangle, shape, drawing classes..rectangle class inherits shape class (is - a relationship), and drawing class has shape class(aggregation) Shape Class: Public MustInherit Class CShape Rectangle Class: Public Class CRectangle
7
15194
by: Bruce One | last post by:
In C#, how would people implement a relationship between Customer class and Request class, considering a customer may have 0-n requests and a request must belong to 1 and only 1 customer...? Would about the following options? OPTION 1 -------------------------- public class Customer() { private int CustomerID;
0
1242
by: Karigar | last post by:
I have been so far developing COM servers and clients in C++. I am new to C#/NET way of doing COM and was wondering if it is possible to accomplish aggregation in .NET platform. By aggregation I mean classic COM aggregation in which the outer object controls which interfaces it of inner object it exposes, and to the outside world it appears as the inner object without having to implement all the interfaces. By aggregation I do not mean a...
6
7842
by: Jeff | last post by:
hey Can OO Aggregation be described as: - A system of objects that are built using each other any comments? Jeff
0
8617
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, 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...
0
8553
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9112
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, 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...
0
8971
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 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...
1
8822
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,...
0
7650
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4332
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4570
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
1970
bsmnconsultancy
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...

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.