Archived

This forum has been archived. Please start a new discussion on GitHub.

C# and dictionary/sequence problem on ICE 3.0.1

Hi,

i try now my first project with ice and try to compile, with slice2cs, following files:

NodeReferenceIce.ice:
#include "XmlElementIce.ice"

module BISS
{
module Information
{
class NodeReferenceIce extends Datatypes::XmlElementIce
{
string ipAddress;
dictionary<int ,string> portList;
};
};
};

The included file XmlElementIce.ice follows here:

module BISS
{
module Information
{
module Datatypes
{
class XmlElementIce
{
string name;
int mapId;
int typeId;
};

class IntegerIce extends XmlElementIce
{
int val;
};

class DateTimeIce extends XmlElementIce
{
long ticks;
};
};
};
};

every time i try to compile this two files i got an syntax error on line 10 in the NodeReferenceIce.ice file. Here is the dictionary entry and even if i replace it with an sequence i got a syntax.

In the manual this is the definition for dictionary entrys so i don't now whats wrong!

I have ICE 3.0.1 and .NET 1.1

Best Regards

Thomas Krieger

Thomas Krieger
Analytic Pipe GmbH
http://www.analyticpipe.de

Comments

  • dwayne
    dwayne St. John's, Newfoundland
    Hi Thomas,

    You cannot define a dictionary type inside of a class definition. Instead you need to define the type outside the class and then use the type to declare a data member in your class. Your slice should look something like this...
    module BISS
    {
    module Information
    {
    
    dictionary<int ,string> portList;  // Define the dictionary type.
    
    class NodeReferenceIce extends Datatypes::XmlElementIce
    {
        string ipAddress;
        portList  ports; // Declare a portList dictionary data member.
    };
    
    };
    };
    

    Regards,
    Dwayne
  • Thanks...

    Ok this makes sense...thanks for your quick good answer!

    Greetings

    Thomas Krieger