PDA

View Full Version : Syntax Warning on Ninja Editor but not Microsoft


ct
10-04-2007, 10:47 PM
I get a warning in the Ninja editor but not the Microsoft Visual C# editor. It compiles and works fine but would like to remove the warning in Ninja.

Any ideas what it doesn't like?


Here is the statement:
int IComparable<NonUniqueKey_<Type, TComparer>>.CompareTo(NonUniqueKey_<Type, TComparer> k)

The errors displayed are:
"> expected."
"Class member declaration expected."


Here is the block of code:
public class NonUniqueKey_<Type, TComparer> : IComparable<NonUniqueKey_<Type, TComparer>>, IComparable
where Type : IComparable<Type>
where TComparer : IComparer<Type>
{
public static NonUniqueKey_<Type, TComparer> New(Type key, TComparer cmp)
{
return new NonUniqueKey_<Type, TComparer>(key, cmp);
}

Type _key;
TComparer _cmp;
public NonUniqueKey_()
{
}
public NonUniqueKey_(Type key, TComparer cmp)
{
_key = key;
_cmp = cmp;
}
public NonUniqueKey_(NonUniqueKey_<Type, TComparer> k)
{
_key = k._key;
_cmp = k._cmp;
}
public NonUniqueKey_<Type, TComparer> Clone()
{
return new NonUniqueKey_<Type, TComparer>(this);
}
public int CompareTo(object o)
{
return (_cmp.Compare(_key, ((NonUniqueKey_<Type, TComparer>)o)._key) < 0) ? -1 : 1;
}
int IComparable<NonUniqueKey_<Type, TComparer>>.CompareTo(NonUniqueKey_<Type, TComparer> k)
{
return (_cmp.Compare(_key, k._key) < 0) ? -1 : 1;
}

public static explicit operator Type (NonUniqueKey_<Type, TComparer> k)
{
return k._key;
}
}

NinjaTrader_Dierk
10-05-2007, 07:01 AM
Sorry I don't know. We rarely use C# generics.

ct
10-05-2007, 07:03 AM
Dierk

Danke.

Cliff