Problem with Attribute "XmlIncludeAttribute" in Managed C++

D

Danny Korach

Hi,

I have created a very basic Managed C++ project.
The contents is just bellow.
Two classes: Class1, Class2.
Class2 has a member of type Class1.
I'm trying to write code that serialize it using XML
serialization.
Before I even write my other code, the following code
won't compile with the following complication error on
the line of the "XmlIncludeAttribute":
--------------------
C3303: 'System::Xml::Serialization::XmlIncludeAttribute':
attribute can only be used on 'classes, structs, non-enum
value types, methods'
--------------------


Here is where my small code starts.

using namespace System;
using namespace System::Xml::Serialization;

namespace Project1
{
public __gc class Class1
{
public:
String * m_sName;
};

public __gc class Class2
{
public:

[System::Xml::Serialization::XmlIncludeAttribute
(__typeof(Class1))]
Class1 * m_objClass1;
};

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top