471,350 Members | 1,850 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

Generic list from C++ to C#

Hi,

I have a field named "BaseClasses" in C++ as in the following simplified
code:

using Collections::Generic::List;
namespace A2M { namespace LipIntrospection {
public ref class BaseClassInfo
{
...
};

public ref class ClassInfo
{
public:
List<BaseClassInfo^> BaseClasses;
...
};
}}

The problem is that when "BaseClasses" is accessed in C#, I get an error
"is not supported in the language". I'm able to use the BaseClassInfo
class without problem and I'm also able to define a List<BaseClassInfo>
in C#. Out of curiosity, I compared the types of the list in C# and C++
and I got the following:

"System.Collections.Generic.List`1[[A2M.LipIntrospection.BaseClassInfo,
LipIntrospection, Version=1.0.2196.29053, Culture=neutral,
PublicKeyToken=null]]"

"System.Collections.Generic.List`1[[A2M.LipIntrospection.BaseClassInfo,
LipIntrospection, Version=1.0.2196.29233, Culture=neutral,
PublicKeyToken=null]]"

Is it possible that C++ and C# are using different versions of the
generic list?

Note that I'm pretty new to .Net and C#, so maybe I'm missing something?

Thx and regards,
Nicolas Fleury
Jan 5 '06 #1
2 5386

"Nicolas Fleury" <ni******@yahoo.com_remove_the_> wrote in message
news:%d********************@news20.bellglobal.com. ..
Hi,

I have a field named "BaseClasses" in C++ as in the following simplified
code:

using Collections::Generic::List;
namespace A2M { namespace LipIntrospection {
public ref class BaseClassInfo
{
...
};

public ref class ClassInfo
{
public:
List<BaseClassInfo^> BaseClasses;
...
};
}}

The problem is that when "BaseClasses" is accessed in C#, I get an error
"is not supported in the language". I'm able to use the BaseClassInfo
class without problem and I'm also able to define a List<BaseClassInfo> in
C#. Out of curiosity, I compared the types of the list in C# and C++ and
I got the following:

"System.Collections.Generic.List`1[[A2M.LipIntrospection.BaseClassInfo,
LipIntrospection, Version=1.0.2196.29053, Culture=neutral,
PublicKeyToken=null]]"

"System.Collections.Generic.List`1[[A2M.LipIntrospection.BaseClassInfo,
LipIntrospection, Version=1.0.2196.29233, Culture=neutral,
PublicKeyToken=null]]"

Is it possible that C++ and C# are using different versions of the generic
list?

Note that I'm pretty new to .Net and C#, so maybe I'm missing something?

Thx and regards,
Nicolas Fleury


List<BaseClassInfo^> BaseClasses;

should be

List<BaseClassInfo^> ^BaseClasses;

C# does not support stackbased semantics, so you must declare a reference.

Willy.

Jan 5 '06 #2
Willy Denoyette [MVP] wrote:
List<BaseClassInfo^> BaseClasses;

should be

List<BaseClassInfo^> ^BaseClasses;

C# does not support stackbased semantics, so you must declare a reference.


Oups. Thx, stupid mistake from me; haven't notice it for this field
because the preceding field was a simple type.

Thx,
Nicolas
Jan 6 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by JAL | last post: by
reply views Thread by Wiktor Zychla [C# MVP] | last post: by
reply views Thread by crazyone | last post: by
3 posts views Thread by Seth Gecko | last post: by
4 posts views Thread by =?Utf-8?B?QkogU2FmZGll?= | last post: by
13 posts views Thread by rkausch | last post: by
5 posts views Thread by Jon Slaughter | last post: by
reply views Thread by XIAOLAOHU | last post: by

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.