473,513 Members | 2,448 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting object properties from interface reference

Hi,

Here's the problem:
Say a have a class, implementing an interface:

// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv v
public class GraphClass : IGraphInterface
{
public string Property1 {
get {
return value1;
}
set {
value1 = value;
}
}

public string Property2 {
get {
return value2;
}
set {
value2 = value;
}
}
/*Some other code*/
}
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^

Say, somewhere in my progarm i do the following:

IGraphInterface gc = new GraphClass();

Is there a way to get a list of properties (Property1, Property2, etc) along with their names
(if possible) from the instance 'gc', if it's referenced as interface, like in the example?
I can assume that yes, because it's done somehow by VS IDE, when you use UserControls, where you can
define a property which will appear in "Properties" toolbar.
Any ideas would be highly appreciated!

Thank you in advance,
Andrey
Nov 16 '05 #1
3 1544
You could try using reflection, but you will not be able to early bind your
method calls because, as you are aware, the compiler only sees the interface
members.

"Andrey" <le*******@yahoo.com> wrote in message
news:Drp2d.57093$MQ5.10885@attbi_s52...
Hi,

Here's the problem:
Say a have a class, implementing an interface:

// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv v
public class GraphClass : IGraphInterface
{
public string Property1 {
get {
return value1;
}
set {
value1 = value; }
}

public string Property2 {
get {
return value2;
}
set {
value2 = value; }
}
/*Some other code*/
}
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^

Say, somewhere in my progarm i do the following:

IGraphInterface gc = new GraphClass();

Is there a way to get a list of properties (Property1, Property2, etc)
along with their names
(if possible) from the instance 'gc', if it's referenced as interface,
like in the example?
I can assume that yes, because it's done somehow by VS IDE, when you use
UserControls, where you can define a property which will appear in
"Properties" toolbar.
Any ideas would be highly appreciated!

Thank you in advance,
Andrey

Nov 16 '05 #2
>
"Andrey" <le*******@yahoo.com> wrote in message
news:Drp2d.57093$MQ5.10885@attbi_s52...
Hi,

Here's the problem:
Say a have a class, implementing an interface:

// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv v
public class GraphClass : IGraphInterface
{
public string Property1 {
get {
return value1;
}
set {
value1 = value; }
}

public string Property2 {
get {
return value2;
}
set {
value2 = value; }
}
/*Some other code*/
}
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^

Say, somewhere in my progarm i do the following:

IGraphInterface gc = new GraphClass();

Is there a way to get a list of properties (Property1, Property2, etc)
along with their names
(if possible) from the instance 'gc', if it's referenced as interface,
like in the example?
I can assume that yes, because it's done somehow by VS IDE, when you use
UserControls, where you can define a property which will appear in
"Properties" toolbar.
Any ideas would be highly appreciated!

Thank you in advance,
Andrey

You could try using reflection, but you will not be able to early bind your
method calls because, as you are aware, the compiler only sees the interface
members.

I got your idea! But still,... how does VS see properties of user components?
Or is there any around? Maybe attributes?

What i'm doing is a IDE for a python reporting package. This IDE has the same idea as VS IDE - set
of reporting components which you can drop onto a page, and for each of which you should be able to
set some properties, which obviously are differ by component class

Please any ideas!!!

Thank you in advance
Andrey

Nov 16 '05 #3
Peter Rilling wrote:
You could try using reflection, but you will not be able to early bind your
method calls because, as you are aware, the compiler only sees the interface
members.

I got your idea! But still,... how does VS sees properties of user components?
Or is there any around? Maybe attributes?

What i'm doing is a IDE for a python reporting package. This IDE has the same idea as VS IDE - set
of reporting components which you can drop onto a page, and for each of which you should be able to
set some properties, which obviously are differ by component class

Please any ideas!!!

Thank you in advance
Andrey
"Andrey" <le*******@yahoo.com> wrote in message
news:Drp2d.57093$MQ5.10885@attbi_s52...
Hi,

Here's the problem:
Say a have a class, implementing an interface:

// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv v
public class GraphClass : IGraphInterface
{
public string Property1 {
get {
return value1;
}
set {
value1 = value; }
}

public string Property2 {
get {
return value2;
}
set {
value2 = value; }
}
/*Some other code*/
}
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^

Say, somewhere in my progarm i do the following:

IGraphInterface gc = new GraphClass();

Is there a way to get a list of properties (Property1, Property2, etc)
along with their names
(if possible) from the instance 'gc', if it's referenced as interface,
like in the example?
I can assume that yes, because it's done somehow by VS IDE, when you use
UserControls, where you can define a property which will appear in
"Properties" toolbar.
Any ideas would be highly appreciated!

Thank you in advance,
Andrey



Nov 16 '05 #4

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

Similar topics

2
13373
by: brazilnut52 | last post by:
I am going to outline the steps I go through to produce the problem. Hopefully this will help you understand the problem better I have created a simple COM DLL in .NET by using the COM class...
16
25393
by: sneill | last post by:
How is it possible to take the value of a variable (in this case, MODE_CREATE, MODE_UPDATE, etc) and use that as an object property name? In the following example I want 'oIcon' object to have...
2
1726
by: Jeff Van Epps | last post by:
We've been unable to get events working going from C# to VJ++. We think that the C# component is being exposed properly as a ConnectionPoint, and the Advise() from the VJ++ side seems to be...
6
2442
by: Alan | last post by:
I am trying to develop an ATL COM object together with a C# web application that will host it. I am following the COM Interop Part 1: C# Client Tutorial, Example 2, The C# Code Approach from the...
15
6719
by: Carlos Lozano | last post by:
Hi, What is the right way to create an OCX COM component. The component is already registerred, but can't create an instance. I am using the reference to the interop module created. If I use...
6
20032
by: Sameh Ahmed | last post by:
Hello there I need to get the "PwdLastSet" of a user object to know when he last set his password. I am using DirectoryServices.DirectoryEntry to bind to the user object, but it either gives...
15
26212
by: mr.peteryu | last post by:
Hi, Can someone explain the idea behind casting to an interface? For example: -> I have an IInterface that contains a Read() method. -> I have an object "obj" that implements IInterface. ...
0
1467
by: Jan | last post by:
I just started using .NET Remoting. I have a test system (client) which connects to our device (server) running XP Embedded. When my server object is called it uses a library where reflection...
41
2826
by: Jim | last post by:
Hi guys, I have an object which represents an "item" in a CMS "component" where an "item" in the most basic form just a field, and a "component" is effectively a table. "item" objects can be...
0
7171
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
7388
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
7545
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...
1
7111
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...
1
5095
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4751
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3240
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...
1
807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
461
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...

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.