Re: Class problem
- From: "Lee Franke" <lee.franke@xxxxxxxxxxxxxxx>
- Date: Fri, 2 Sep 2005 17:00:07 -0500
Well that is interesting. I was not paying that close attention (obviously).
So I guess you cannot view a class within a class. That seems to be a bit
limiting and it makes sense with what I am seeing on the appilcation.
The Assembly Class (part of the System.Reflection namespace) is not
recoginzing the foo member variable as a class.
thanks for the help,
lee franke
"Jeremy Williams" <jeremydwill@xxxxxxxxxxxx> wrote in message
news:%23zwQiMAsFHA.3720@xxxxxxxxxxxxxxxxxxxxxxx
> In your example, the first 'System' is the assembly, the second 'System'
> is the namespace, and the 'URI' is a class definition. This is easy to
> determine by selecting each node in the tree, and looking at the
> information displayed about that node. For the root 'System' node, you see
> this:
>
> ---------
> Assembly System
> C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dl
> ---------
>
> When you select the 'System' node located under the root 'System' node,
> you see this:
> ---------
> Namespace System
> Member of: System
> ---------
>
> And when you select the URI node, you see this:
> ---------
> Public Class Uri
> Inherits System.MarshalByRefObject
> Member of: System
>
> Summary:
> Provides an object representation of a uniform resource identifier (URI)
> and easy access to the parts of the URI.
> ---------
>
> So you are not seeing classes within classes, you are seeing
> Assembly-to-Namespace-to-Class relationships.
>
> "Lee Franke" <lee.franke@xxxxxxxxxxxxxxx> wrote in message
> news:euK4qn$rFHA.1252@xxxxxxxxxxxxxxxxxxxxxxx
>>I added that code to the testing classes of foo and foo1. The class
>>library I am attempting to build has 23 classes (4 base classes with many
>>other classes being derived from them) with all sort of member variables
>>at each level.
>>
>> The foo1 and foo class appears in both the Class View and the Object
>> Browser. The foo class is still not be recognized as a class object. For
>> an example use the Object Browser to goto system.System and you will see
>> various class under it like "URI",
>>
>> thanks for all of the help,
>>
>> lee franke
>>
>> "Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote
>> in message news:efpmbX$rFHA.1132@xxxxxxxxxxxxxxxxxxxxxxx
>>> Lee,
>>>
>>> I compiled it as a class library, yes.
>>>
>>> You are talking about the property grid, not the object browser (the
>>> object browser is a very specific utility in VS.NET).
>>>
>>> To get your class to show the properties of the exposed objects, you
>>> want to adorn the classes that you want to be expanded with the
>>> TypeConverter attribute, indicating the type of the
>>> ExpandableObjectConverter, like so:
>>> [TypeConverter(typeof(ExpandableObjectConverter))]
>>> namespace name
>>> {
>>> public class foo
>>> {
>>> }
>>> }
>>>
>>> namespace name
>>> {
>>> public class foo1
>>> {
>>> foo propf = new foo();
>>> }
>>> }
>>>
>>>
>>>
>>> Of course, it is meaningless in the above example, because you don't
>>> have any public properties exposing foo, and foo doesn't have any
>>> properties itself. Try this:
>>>
>>> namespace name
>>> {
>>> [TypeConverter(typeof(ExpandableObjectConverter))]
>>> public class foo
>>> {
>>> public int MyProp
>>> {
>>> get
>>> {
>>> return 0;
>>> }
>>> set
>>> {
>>>
>>> }
>>> }
>>> }
>>> }
>>>
>>> namespace name
>>> {
>>> public class foo1
>>> {
>>> private foo propf = new foo();
>>>
>>> public foo Foo
>>> {
>>> get { return propf; }
>>> set { propf = value; }
>>> }
>>> }
>>> }
>>>
>>>
>>>
>>>
>>> --
>>> - Nicholas Paldino [.NET/C# MVP]
>>> - mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
>>>
>>>
>>>
>>> "Lee Franke" <lee.franke@xxxxxxxxxxxxxxx> wrote in message
>>> news:%23geHv6%23rFHA.3016@xxxxxxxxxxxxxxxxxxxxxxx
>>>> Compiles fine on mine. Are you compiling it as a class library? (mmmm
>>>> maybe that is my problem)
>>>>
>>>> Anyway, I want a class that has a member property another class which
>>>> has its own public member properties.
>>>>
>>>> When you look at it thru an object browser you see foo1 with a little
>>>> '+' sign with foo under it with another little '+' sign.
>>>>
>>>> Make sense?
>>>>
>>>> thanks,
>>>>
>>>> lee
>>>>
>>>>
>>>> "Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
>>>> wrote in message news:eIQo$2%23rFHA.1256@xxxxxxxxxxxxxxxxxxxxxxx
>>>>> Lee,
>>>>>
>>>>> The code, as posted, does not compile fine. You get a "Expected
>>>>> class, delegate, enum, interface, or struct" error on the line:
>>>>>
>>>>> public foo propf;
>>>>>
>>>>>
>>>>> As for the desired results, what are you trying to do?
>>>>>
>>>>>
>>>>> --
>>>>> - Nicholas Paldino [.NET/C# MVP]
>>>>> - mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
>>>>>
>>>>> "Lee Franke" <lee.franke@xxxxxxxxxxxxxxx> wrote in message
>>>>> news:eZ7myx%23rFHA.1172@xxxxxxxxxxxxxxxxxxxxxxx
>>>>>> It compiles fine. But leave that out for a second, how would you get
>>>>>> the desired results then?
>>>>>>
>>>>>> thanks,
>>>>>>
>>>>>> lee franke
>>>>>>
>>>>>>
>>>>>> "Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
>>>>>> wrote in message news:OIyVEv%23rFHA.2596@xxxxxxxxxxxxxxxxxxxxxxx
>>>>>>> Lee,
>>>>>>>
>>>>>>> I don't know what you are expecting to see. This code doesn't
>>>>>>> compile. The "public foo propf" is outside of the foo1 definition,
>>>>>>> and should throw a compiler error.
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> - Nicholas Paldino [.NET/C# MVP]
>>>>>>> - mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
>>>>>>>
>>>>>>>> namespace name
>>>>>>>> {
>>>>>>>> public class foo1
>>>>>>>> {
>>>>>>>> foo propf = new foo();
>>>>>>>> }
>>>>>>>> public foo propf;
>>>>>>>> }
>>>>>>>
>>>>>>> "Lee Franke" <lee.franke@xxxxxxxxxxxxxxx> wrote in message
>>>>>>> news:%23BQuoi%23rFHA.3884@xxxxxxxxxxxxxxxxxxxxxxx
>>>>>>>>I can't seem to figure this one out.
>>>>>>>>
>>>>>>>> Here is my class structure
>>>>>>>>
>>>>>>>> namespace name
>>>>>>>> {
>>>>>>>> public class foo
>>>>>>>> {
>>>>>>>> }
>>>>>>>> }
>>>>>>>>
>>>>>>>> namespace name
>>>>>>>> {
>>>>>>>> public class foo1
>>>>>>>> {
>>>>>>>> foo propf = new foo();
>>>>>>>> }
>>>>>>>> public foo propf;
>>>>>>>> }
>>>>>>>>
>>>>>>>>
>>>>>>>> In the object browser 'propf' does not show up as a class. It just
>>>>>>>> appears just as a member variable of foo1. In the object browser if
>>>>>>>> you look at the system.System object you see several objects that
>>>>>>>> are members variables and you can expand them.
>>>>>>>>
>>>>>>>> What am I missing?
>>>>>>>>
>>>>>>>> thanks,
>>>>>>>>
>>>>>>>> lee franke
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
.
- Follow-Ups:
- Re: Class problem
- From: Evan Stone
- Re: Class problem
- References:
- Class problem
- From: Lee Franke
- Re: Class problem
- From: Nicholas Paldino [.NET/C# MVP]
- Re: Class problem
- From: Lee Franke
- Re: Class problem
- From: Nicholas Paldino [.NET/C# MVP]
- Re: Class problem
- From: Lee Franke
- Re: Class problem
- From: Nicholas Paldino [.NET/C# MVP]
- Re: Class problem
- From: Lee Franke
- Re: Class problem
- From: Jeremy Williams
- Class problem
- Prev by Date: Re: Is Boxing and UnBoxing Really Necessary?
- Next by Date: Char[] Array
- Previous by thread: Re: Class problem
- Next by thread: Re: Class problem
- Index(es):
Relevant Pages
|