Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Syntax Warning on Ninja Editor but not Microsoft

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Syntax Warning on Ninja Editor but not Microsoft

    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;
    }
    }

    #2
    Sorry I don't know. We rarely use C# generics.

    Comment


      #3
      Dierk

      Danke.

      Cliff

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by burtoninlondon, Today, 12:38 AM
      0 responses
      10 views
      0 likes
      Last Post burtoninlondon  
      Started by AaronKoRn, Yesterday, 09:49 PM
      0 responses
      14 views
      0 likes
      Last Post AaronKoRn  
      Started by carnitron, Yesterday, 08:42 PM
      0 responses
      11 views
      0 likes
      Last Post carnitron  
      Started by strategist007, Yesterday, 07:51 PM
      0 responses
      14 views
      0 likes
      Last Post strategist007  
      Started by StockTrader88, 03-06-2021, 08:58 AM
      44 responses
      3,983 views
      3 likes
      Last Post jhudas88  
      Working...
      X