By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,677 Members | 1,298 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,677 IT Pros & Developers. It's quick & easy.

Class problem

P: n/a
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
Nov 17 '05 #1
Share this Question
Share on Google+
14 Replies


P: n/a
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]
- mv*@spam.guard.caspershouse.com
namespace name
{
public class foo1
{
foo propf = new foo();
}
public foo propf;
}
"Lee Franke" <le********@fnc.fujitsu.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...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

Nov 17 '05 #2

P: n/a
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]" <mv*@spam.guard.caspershouse.com> wrote in
message news:OI****************@TK2MSFTNGP09.phx.gbl...
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]
- mv*@spam.guard.caspershouse.com
namespace name
{
public class foo1
{
foo propf = new foo();
}
public foo propf;
}


"Lee Franke" <le********@fnc.fujitsu.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
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


Nov 17 '05 #3

P: n/a
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]
- mv*@spam.guard.caspershouse.com

"Lee Franke" <le********@fnc.fujitsu.com> wrote in message
news:eZ****************@TK2MSFTNGP11.phx.gbl...
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]" <mv*@spam.guard.caspershouse.com> wrote
in message news:OI****************@TK2MSFTNGP09.phx.gbl...
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]
- mv*@spam.guard.caspershouse.com
namespace name
{
public class foo1
{
foo propf = new foo();
}
public foo propf;
}


"Lee Franke" <le********@fnc.fujitsu.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
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



Nov 17 '05 #4

P: n/a
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]" <mv*@spam.guard.caspershouse.com> wrote in
message news:eI****************@TK2MSFTNGP09.phx.gbl...
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]
- mv*@spam.guard.caspershouse.com

"Lee Franke" <le********@fnc.fujitsu.com> wrote in message
news:eZ****************@TK2MSFTNGP11.phx.gbl...
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]" <mv*@spam.guard.caspershouse.com> wrote
in message news:OI****************@TK2MSFTNGP09.phx.gbl...
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]
- mv*@spam.guard.caspershouse.com

namespace name
{
public class foo1
{
foo propf = new foo();
}
public foo propf;
}

"Lee Franke" <le********@fnc.fujitsu.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
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



Nov 17 '05 #5

P: n/a
Are you sure you are compiling this with csc? :-))
This code can't compile because all members must be declared inside class
(that's what their name says)

This is the most similar code to yours which would compile (if using csc, of
course :D)
namespace name
{
public class foo1
{
public foo propf = new foo();
}
}
"Lee Franke" <le********@fnc.fujitsu.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
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]" <mv*@spam.guard.caspershouse.com> wrote in message news:eI****************@TK2MSFTNGP09.phx.gbl...
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]
- mv*@spam.guard.caspershouse.com

"Lee Franke" <le********@fnc.fujitsu.com> wrote in message
news:eZ****************@TK2MSFTNGP11.phx.gbl...
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]" <mv*@spam.guard.caspershouse.com> wrote in message news:OI****************@TK2MSFTNGP09.phx.gbl...
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]
- mv*@spam.guard.caspershouse.com

> namespace name
> {
> public class foo1
> {
> foo propf = new foo();
> }
> public foo propf;
> }

"Lee Franke" <le********@fnc.fujitsu.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
>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
>



Nov 17 '05 #6

P: n/a
I'm NOT compiling with csc. I'm compliing thru the VS interface.

Interestingly enought, yours does not compile with teh VS interface.

thanks,

lee
"Lebesgue" <no****@spam.jp> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Are you sure you are compiling this with csc? :-))
This code can't compile because all members must be declared inside class
(that's what their name says)

This is the most similar code to yours which would compile (if using csc,
of
course :D)
namespace name
{
public class foo1
{
public foo propf = new foo();
}
}
"Lee Franke" <le********@fnc.fujitsu.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
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]" <mv*@spam.guard.caspershouse.com> wrote

in
message news:eI****************@TK2MSFTNGP09.phx.gbl...
> 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]
> - mv*@spam.guard.caspershouse.com
>
> "Lee Franke" <le********@fnc.fujitsu.com> wrote in message
> news:eZ****************@TK2MSFTNGP11.phx.gbl...
>> 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]" <mv*@spam.guard.caspershouse.com> wrote >> in message news:OI****************@TK2MSFTNGP09.phx.gbl...
>>> 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]
>>> - mv*@spam.guard.caspershouse.com
>>>
>>>> namespace name
>>>> {
>>>> public class foo1
>>>> {
>>>> foo propf = new foo();
>>>> }
>>>> public foo propf;
>>>> }
>>>
>>> "Lee Franke" <le********@fnc.fujitsu.com> wrote in message
>>> news:%2******************@TK2MSFTNGP11.phx.gbl...
>>>>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
>>>>
>>>
>>>
>>
>>
>
>



Nov 17 '05 #7

P: n/a

I am using VS 2003 and the following compiles
namespace TestNGCSharp
{
public class foo {
}

public class foo1 {
public foo propf = new foo();
}

}
In the original posting, propf was declared inside the namespace but
outside a class definition and should (does on my machine) give an
error.
Variable cannot exist free floating in a namespace.

A possibility is that there is a mixup somewhere on parentheses
public class foo {

public class foo1 {
foo propf = new foo();
}

public foo propf;

}

does compile becuase the compiler sees foo1 as an embedded class and
foo as a variable within the foo class - strange but syntactically
correct.

- Check on the parentheses.
- Try with a new file and only the lines from the posting / examples
and see what happens.
hth,
Alan.

Nov 17 '05 #8

P: n/a
Dear Mr. Lee Franke,
VS is using csc to compile C# projects. csc stands for Microsoft Visual C#
..NET Compiler, that's the thing that compiles C# source code. I just wanted
to make a joke, in other language (and using different compiler), your
sample would compile, maybe.
Your sample is not a valid C# code.

"Lee Franke" <le********@fnc.fujitsu.com> wrote in message
news:OR**************@TK2MSFTNGP12.phx.gbl...
I'm NOT compiling with csc. I'm compliing thru the VS interface.

Interestingly enought, yours does not compile with teh VS interface.

thanks,

lee
"Lebesgue" <no****@spam.jp> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Are you sure you are compiling this with csc? :-))
This code can't compile because all members must be declared inside class (that's what their name says)

This is the most similar code to yours which would compile (if using csc, of
course :D)
namespace name
{
public class foo1
{
public foo propf = new foo();
}
}
"Lee Franke" <le********@fnc.fujitsu.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
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]" <mv*@spam.guard.caspershouse.com>
wrote in
message news:eI****************@TK2MSFTNGP09.phx.gbl...
> 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]
> - mv*@spam.guard.caspershouse.com
>
> "Lee Franke" <le********@fnc.fujitsu.com> wrote in message
> news:eZ****************@TK2MSFTNGP11.phx.gbl...
>> 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]" <mv*@spam.guard.caspershouse.com>

wrote
>> in message news:OI****************@TK2MSFTNGP09.phx.gbl...
>>> 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]
>>> - mv*@spam.guard.caspershouse.com
>>>
>>>> namespace name
>>>> {
>>>> public class foo1
>>>> {
>>>> foo propf = new foo();
>>>> }
>>>> public foo propf;
>>>> }
>>>
>>> "Lee Franke" <le********@fnc.fujitsu.com> wrote in message
>>> news:%2******************@TK2MSFTNGP11.phx.gbl...
>>>>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
>>>>
>>>
>>>
>>
>>
>
>



Nov 17 '05 #9

P: n/a
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]
- mv*@spam.guard.caspershouse.com

"Lee Franke" <le********@fnc.fujitsu.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
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]" <mv*@spam.guard.caspershouse.com> wrote
in message news:eI****************@TK2MSFTNGP09.phx.gbl...
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]
- mv*@spam.guard.caspershouse.com

"Lee Franke" <le********@fnc.fujitsu.com> wrote in message
news:eZ****************@TK2MSFTNGP11.phx.gbl...
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]" <mv*@spam.guard.caspershouse.com> wrote
in message news:OI****************@TK2MSFTNGP09.phx.gbl...
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]
- mv*@spam.guard.caspershouse.com

> namespace name
> {
> public class foo1
> {
> foo propf = new foo();
> }
> public foo propf;
> }

"Lee Franke" <le********@fnc.fujitsu.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
>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
>



Nov 17 '05 #10

P: n/a
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]" <mv*@spam.guard.caspershouse.com> wrote in
message news:ef**************@TK2MSFTNGP10.phx.gbl...
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]
- mv*@spam.guard.caspershouse.com

"Lee Franke" <le********@fnc.fujitsu.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
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]" <mv*@spam.guard.caspershouse.com> wrote
in message news:eI****************@TK2MSFTNGP09.phx.gbl...
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]
- mv*@spam.guard.caspershouse.com

"Lee Franke" <le********@fnc.fujitsu.com> wrote in message
news:eZ****************@TK2MSFTNGP11.phx.gbl...
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]" <mv*@spam.guard.caspershouse.com>
wrote in message news:OI****************@TK2MSFTNGP09.phx.gbl...
> 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]
> - mv*@spam.guard.caspershouse.com
>
>> namespace name
>> {
>> public class foo1
>> {
>> foo propf = new foo();
>> }
>> public foo propf;
>> }
>
> "Lee Franke" <le********@fnc.fujitsu.com> wrote in message
> news:%2******************@TK2MSFTNGP11.phx.gbl...
>>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
>>
>
>



Nov 17 '05 #11

P: n/a
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\Syste m.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" <le********@fnc.fujitsu.com> wrote in message
news:eu**************@TK2MSFTNGP09.phx.gbl...
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]" <mv*@spam.guard.caspershouse.com> wrote
in message news:ef**************@TK2MSFTNGP10.phx.gbl...
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]
- mv*@spam.guard.caspershouse.com

"Lee Franke" <le********@fnc.fujitsu.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
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]" <mv*@spam.guard.caspershouse.com> wrote
in message news:eI****************@TK2MSFTNGP09.phx.gbl...
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]
- mv*@spam.guard.caspershouse.com

"Lee Franke" <le********@fnc.fujitsu.com> wrote in message
news:eZ****************@TK2MSFTNGP11.phx.gbl...
> 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]" <mv*@spam.guard.caspershouse.com>
> wrote in message news:OI****************@TK2MSFTNGP09.phx.gbl...
>> 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]
>> - mv*@spam.guard.caspershouse.com
>>
>>> namespace name
>>> {
>>> public class foo1
>>> {
>>> foo propf = new foo();
>>> }
>>> public foo propf;
>>> }
>>
>> "Lee Franke" <le********@fnc.fujitsu.com> wrote in message
>> news:%2******************@TK2MSFTNGP11.phx.gbl...
>>>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
>>>
>>
>>
>
>



Nov 17 '05 #12

P: n/a
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" <je*********@netscape.net> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
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\Syste m.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" <le********@fnc.fujitsu.com> wrote in message
news:eu**************@TK2MSFTNGP09.phx.gbl...
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]" <mv*@spam.guard.caspershouse.com> wrote
in message news:ef**************@TK2MSFTNGP10.phx.gbl...
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]
- mv*@spam.guard.caspershouse.com

"Lee Franke" <le********@fnc.fujitsu.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
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]" <mv*@spam.guard.caspershouse.com>
wrote in message news:eI****************@TK2MSFTNGP09.phx.gbl...
> 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]
> - mv*@spam.guard.caspershouse.com
>
> "Lee Franke" <le********@fnc.fujitsu.com> wrote in message
> news:eZ****************@TK2MSFTNGP11.phx.gbl...
>> 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]" <mv*@spam.guard.caspershouse.com>
>> wrote in message news:OI****************@TK2MSFTNGP09.phx.gbl...
>>> 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]
>>> - mv*@spam.guard.caspershouse.com
>>>
>>>> namespace name
>>>> {
>>>> public class foo1
>>>> {
>>>> foo propf = new foo();
>>>> }
>>>> public foo propf;
>>>> }
>>>
>>> "Lee Franke" <le********@fnc.fujitsu.com> wrote in message
>>> news:%2******************@TK2MSFTNGP11.phx.gbl...
>>>>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
>>>>
>>>
>>>
>>
>>
>
>



Nov 17 '05 #13

P: n/a
> So I guess you cannot view a class within a class.

Sure you can. Both Class View and the Object Browser shows nested
classes, but they display the information in slightly different ways.

If I enter the following:

namespace MyNamespace
{
public class Outer
{
public class Inner
{
}
}
}

....and look at Class View (expanded), it looks like the following, which
is hierarchical, like you'd expect:

- projectname
- MyNamespace
- Outer
+ Bases and Interfaces
+ Inner
However, if I go to the Object Browser, I see the following:

- projectname
- MyNamespace
+ Outer
+ Outer.Inner

So the information _is_ there, but it's just represented a little
differently in the Object Browser.

Hope this helps.

:: evan.st0ne | software_engineer + dj
:: -----------------------------------------
:: http://evanstone.blogspot.com/
:: petaluma, ca, usa
Nov 17 '05 #14

P: n/a
Yep I see how it works now. I just figured that you would be able to drill
down to the member variables of the foo class without declaring it like
Inner in your example.

I am attempting to replicate the functionality of Intellisense in my custom
app for a custom structure of classes. I am using the Assembly class to try
and iterate down the class structure.

I'll probably post a question on Monday seeing if anyone has used/customized
the Intellisense in a custom application.

thanks for all your help,

lee franke

"Evan Stone" <re*********************@hotmail.com> wrote in message
news:O3**************@TK2MSFTNGP10.phx.gbl...
So I guess you cannot view a class within a class.


Sure you can. Both Class View and the Object Browser shows nested classes,
but they display the information in slightly different ways.

If I enter the following:

namespace MyNamespace
{
public class Outer
{
public class Inner
{
}
}
}

...and look at Class View (expanded), it looks like the following, which
is hierarchical, like you'd expect:

- projectname
- MyNamespace
- Outer
+ Bases and Interfaces
+ Inner
However, if I go to the Object Browser, I see the following:

- projectname
- MyNamespace
+ Outer
+ Outer.Inner

So the information _is_ there, but it's just represented a little
differently in the Object Browser.

Hope this helps.

:: evan.st0ne | software_engineer + dj
:: -----------------------------------------
:: http://evanstone.blogspot.com/
:: petaluma, ca, usa

Nov 17 '05 #15

This discussion thread is closed

Replies have been disabled for this discussion.