473,385 Members | 1,593 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,385 software developers and data experts.

Easier access to PropertyInfo

Hi,

This is my first post on this mailing list as I am quite new to the c#
programming language. So please be patient ;)

I am currently developing a small framework that can connect two properties
of two objects. Therefore I create a Connection object, that gets the input
object i and the PropertyInfo of the property that should be used as input,
and an output object o and the PropertyInfo of the property that acts as
the output. A call for creating the connection currently looks like this :

graph.AddConnection(
i, i.GetType().GetProperty("Input"),
o, o.GetType().GetProperty("Output"));

This is ok, but not satisfying for me :D.
I want the user of the framework to be able to create a connection like
this:

graph.AddConnection(i.Input, o.Output);

So by calling the properties "getter method" I want to get the object the
getter method is called on and the property info the getter method has
called for.

I don't even know if this possible, but would be great ;)

Thx for your help,

Marco
Jun 27 '08 #1
2 1007
I want the user of the framework to be able to create a connection like
this:
graph.AddConnection(i.Input, o.Output);
A few options leap to mind:
Te simplest is just a half-way house is to handle the lookup inside the
method:
graph.AddConnection(i, "Input", o, "Output");
But of course it still isn't compiler-verified.

You could do various things involving delegates and lambdas, including
treating a lambda as the missing "infoof" operator, which would allow
you to refer to a property directy (and safely), but simply: they are
all quite complicated.

That said, you are also duplicating a lot of what Binding does (at least
for the UI).

You haven't really indicated how it would be *used* (i.e. end-to-end,
not just creation), which probably counts for a lot in terms of giving
the best reply...

Marc
Jun 27 '08 #2
Just to warn you that this sounds *awfully* like what System.Expression
does... even if just to rule it out, you might want to see what .NET 3.5
and C# 3 bring to this...

Marc
Jun 27 '08 #3

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

Similar topics

4
by: Hugh O | last post by:
Hi, I have been able to use the following kinds of code to access basic information on the individual controls that would be in any Web page. ?Me.Controls(1).Controls(56).GetType.Name ' ...
5
by: Przemek M. Zawada | last post by:
Dear Group, I'm curious, whether is possible such trick in C#: Basically speaking, in PHP what I do, is I assign an object variables using simple loop: class MyObject { private $myObjVar;...
4
by: rajshresta | last post by:
How do we access the nested class dynamically in .NET ? Basically I am using third party code (psn.disc assembly) to run few tasks and the requirement is to dynamically load the assembly at run-time....
1
by: PALLAVI SHARMA | last post by:
Sir, i have configure the ms access file on webserver. MS. Access file is showing in .../db/mohan.mdb on web server. could you tell me what path should in write in my language to update the...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.