Details

    • Type: Language-Specification
    • Status: Active
    • Resolution: Unresolved
    • Labels:
      None
    • Impact:
      Unknown 'null' severity
    • Likelihood:
      Unknown 'null' severity

      Description

      Noncompliant Code Example

      public int Example(int i) 
      {
          return (int) (i + 42); // Noncompliant
      }
      
      public IEnumerable<int> ExampleCollection(IEnumerable<int> coll) 
      {
          return coll.Reverse().OfType<int>(); // Noncompliant
      }
      

      Compliant Solution

      public int Example(int i) 
      {
          return i + 42;
      }
      
      public IEnumerable<int> ExampleCollection(IEnumerable<int> coll) 
      {
          return coll.Reverse();
      }
      

      Exceptions

      Issues are not raised against C# 7.1 default literal.

      bool b = (bool)default; // Doesn't raise an issue
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            tamas.vajk Tamas Vajk (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: