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

How can I get a propertydescriptor directly

Hi

i have a class eg.

class Person
{
public string surname...
public string phone....
}

i know, its possible to get a propertydescriptor with the name
(string) or index (int)

o = new person()

propertydescriptor pd =TypeDescriptor.GetProperties(o)["phone"]

OK

but how can i get the propertydescriptor directly (without the name
oder index)
like " propertydescriptor pd = ....GetPropertyDescriptor(o.phone) "

thanks
Peter
Nov 16 '05 #1
1 15969
Peter,

You can't really. I mean, you seem to have a string representing the
property already (if you can type "phone" in the code, then you can create a
constant string called "phone" and use that). Other than that, there is no
intrinsic way (a la typeof) that you can use to get a property descriptor.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Peter" <pR****@procom-gmbh.com> wrote in message
news:c4**************************@posting.google.c om...
Hi

i have a class eg.

class Person
{
public string surname...
public string phone....
}

i know, its possible to get a propertydescriptor with the name
(string) or index (int)

o = new person()

propertydescriptor pd =TypeDescriptor.GetProperties(o)["phone"]

OK

but how can i get the propertydescriptor directly (without the name
oder index)
like " propertydescriptor pd = ....GetPropertyDescriptor(o.phone) "

thanks
Peter

Nov 16 '05 #2

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

Similar topics

0
by: margoulin | last post by:
Hi, how can I get the defautl PropertyDescriptor of a basic type, lets say int ? Thanks, -Marc
0
by: Alx Sharp | last post by:
Hello group! I've created a collection class that implements ITypedList: class MyCollection : IBindingList, IList, ICollection, IEnumerable, ITypedList { PropertyDescriptorCollection...
5
by: Genboy | last post by:
My "VIS" Website, which is a C# site created in VS.NET, Framework 1.1, is no longer compiling for me via the command line. As I have done 600 times in the last year and a half, I can compile to...
2
by: joye | last post by:
Hello, My question is how to use C# to call the existing libraries containing unmanaged C++ classes directly, but not use C# or managed C++ wrappers unmanaged C++ classes? Does anyone know how...
5
by: Tom | last post by:
I am converting an old application that was printing directly to a specialized printer device (i.e. a special label printer). It was doing this by opening a file with the file path of 'LPT1:' and...
1
by: tomb | last post by:
My CustomCollection has several events based on ListChanged collection management, when the ListChanged event is raised the ListChangedEventArgs.PropertyDescriptor property is always null. Any...
5
by: TS | last post by:
is it preferred to access member variables directly in code, on the page that declared them, versus going thru a property accessor? I would think that since theres no security concerns or anything...
2
by: Marc Gravell | last post by:
::: Question: Does anyone know of a simple Control / UserControl implementation that hosts a UITypeEditor? Or the correct way to call PropertyDescriptor.GetEditor() and get a non-null result for...
11
by: colin | last post by:
Hi, Ive written a custom PropertyDescriptor wich lets me edit my custom data items in the property editor, however I now wish to expand it so that it can be used to edit nested collections of...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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
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
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
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,...

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.