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

XmlSchemaDatatype.Variety protected member access

gar
Hi,
I'm trying to get the Variety property from an instance of an
XmlSchemaDatatype. The property is internal. I'm trying to use reflection to
access it as follows.

object variety = datatype.GetType().GetProperty("Variety",
BindingFlags.FlattenHierarchy | BindingFlags.GetProperty |
BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public );

It returns null. However in the locals window I can see the Variiety
property is 'Atomic'. What am I doing wrong? I've tried a number of
combinations of BindingFlags to no avail.

Regards
Gar

Nov 12 '05 #1
2 965
Consider moving to .net framework 2.0 beta2 which has this property turned
public.

"gar" <ga*@discussions.microsoft.com> wrote in message
news:C3**********************************@microsof t.com...
Hi,
I'm trying to get the Variety property from an instance of an
XmlSchemaDatatype. The property is internal. I'm trying to use reflection to access it as follows.

object variety = datatype.GetType().GetProperty("Variety",
BindingFlags.FlattenHierarchy | BindingFlags.GetProperty |
BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public );

It returns null. However in the locals window I can see the Variiety
property is 'Atomic'. What am I doing wrong? I've tried a number of
combinations of BindingFlags to no avail.

Regards
Gar

Nov 12 '05 #2
The GetProperty method on System.Type will return a PropertyInfo object and
not the value of the property. To directly get the value of the property,
try using the InvokeMember method instead:

object variety = datatype.GetType().InvokeMember("Variety",
BindingFlags.GetProperty | BindingFlags.NonPublic | BindingFlags.Instance,
null, datatype, null);

Thanks,
Priya

"gar" <ga*@discussions.microsoft.com> wrote in message
news:C3**********************************@microsof t.com...
Hi,
I'm trying to get the Variety property from an instance of an
XmlSchemaDatatype. The property is internal. I'm trying to use reflection to access it as follows.

object variety = datatype.GetType().GetProperty("Variety",
BindingFlags.FlattenHierarchy | BindingFlags.GetProperty |
BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public );

It returns null. However in the locals window I can see the Variiety
property is 'Atomic'. What am I doing wrong? I've tried a number of
combinations of BindingFlags to no avail.

Regards
Gar

Nov 12 '05 #3

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

Similar topics

2
by: Kevin Saff | last post by:
Apparently I'm missing something. Stroustrup (15.3) says of protected access: If is protected, its name can be used only by member functions and friends of the class in which it is declared...
2
by: Steven T. Hatton | last post by:
I find the surprising. If I derive Rectangle from Point, I can access the members of Point inherited by Rectangle _IF_ they are actually members of a Rectangle. If I have a member of type Point...
13
by: Adam H. Peterson | last post by:
I just made an observation and I wondered if it's generally known (or if I'm missing something). My observation is that static protected members are essentially useless, only a hint to the user. ...
1
by: Ted | last post by:
I have some code which processes an xsd. For elements of type xs:integer the XmlSchemaDatatype object gotten from the schema elements ElementType member contains a ValueType of System.Decimal. I...
3
by: Nathan Wiegman | last post by:
Hi, Why must derived classes access protected base members through an instance of a derived class? The following code would work in C++, why doesn't it in C#? public class A { protected...
11
by: Kevin Prichard | last post by:
Hi all, I've recently been following the object-oriented techiques discussed here and have been testing them for use in a web application. There is problem that I'd like to discuss with you...
6
by: Roka | last post by:
Hi all why cann't I access protected var from a inherited class? Code example: class Base{ protected: int color; public: virtual void show() = 0; };
15
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello everyone, I met with a strange issue that derived class function can not access base class's protected member. Do you know why? Here is the error message and code. error C2248:...
10
by: blangela | last post by:
If I pass a base class object by reference (likely does not make a difference here that it is passed by reference) as a parameter to a derived class member function, the member function is not...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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.