Handling of Enumerations

2 posts, 0 answers
  1. Holger Boskugel
    Holger Boskugel avatar
    27 posts
    Member since:
    Apr 2012

    Posted 09 Dec 2017 Link to this post

    Two misshandlings of Enumerations observed:

    a) Having enumeration as parameter of method with default value, the value is set as integer not as member of the enumeration

    void MyMethod(MyEnumeration myEnumerationParameter = 1)

    should be

    void MyMethod(MyEnumeration myEnumerationParameter = MyEnumerationMemberOfMyEnbumerationFor1)

    b) Returning enumeration value, which needs to be casted as the returning value is an integer or another enumeration.

    MyEnumeration MyMethod()
    {
      return OtherEnumeration.OtherEnumerationMember;
    }

    should be

    MyEnumeration MyMethod()
    {
      return (MyEnumeration) OtherEnumeration.OtherEnumerationMember;
    }

     

    and

     

    MyEnumeration MyMethod()
    {
      return 1;
    }

    should be

    MyEnumeration MyMethod()
    {
      return (MyEnumeration) 1;
    }
  2. Alexander
    Admin
    Alexander avatar
    336 posts

    Posted 02 Jan Link to this post

    Hello,

    Please, excuse us for the delay in our answer.

    We successfully reproduced a) and it is now added to our backlog. However, we cannot reproduce b). Would it be possible to provide us with sample project for this problem?

    Regards,
    Alexander
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top