You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by GitBox <gi...@apache.org> on 2022/10/15 19:04:00 UTC

[GitHub] [lucenenet] nikcio opened a new issue, #667: Replace this type-check-and-cast sequence with an 'as' and a null check

nikcio opened a new issue, #667:
URL: https://github.com/apache/lucenenet/issues/667

   Mentioned in #648 
   
   Issues found: https://sonarcloud.io/project/issues?resolved=false&rules=csharpsquid%3AS3247&id=nikcio_lucenenet
   
   SonarCloud includes a description on how to solve these issues. Use the "Why is this an issue?" link.
   
   No comment needed. This is more readable and is understood to be a better translation from Java to .NET.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Replace this type-check-and-cast sequence with an 'as' and a null check [lucenenet]

Posted by "paulirwin (via GitHub)" <gi...@apache.org>.
paulirwin commented on issue #667:
URL: https://github.com/apache/lucenenet/issues/667#issuecomment-2491951182

   Better yet, I think we now can do pattern matching to clean this up further, instead of `as`. The top example linked above, instead of:
   
   ```c#
   if (o is string)
   {
       j += ((string)o).Length;
       ...
   }
   ```
   
   should be (without bikeshedding the variable name):
   
   ```c#
   if (o is string oStr)
   {
       j += oStr.Length; // LUCENENET: use pattern matching variable instead of cast
       ...
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Replace type-check-and-cast sequence with pattern matching [lucenenet]

Posted by "paulirwin (via GitHub)" <gi...@apache.org>.
paulirwin closed issue #667: Replace type-check-and-cast sequence with pattern matching
URL: https://github.com/apache/lucenenet/issues/667


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org