IDE0057: Slice can be simplified #3879
-
Some C# analyzer tells me that this line can be optimized:
IDE0057: Slice can be simplified to this
What is the benefit only less text. I would think a range is created here that slows down performance? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
Correct, although I would argue it's more that's it's more declarative than less text. I don't know what the parameters to slice are. Length? Start? Finish? But ranges are a well known construct.
The runtime team works very hard to make sure that isn't the case. They definitely will treat it as a bug if the Jit output is worse. |
Beta Was this translation helpful? Give feedback.
-
There's no issue here with the analyzer fwiw. The analyzer is just telling you can simplify things in this manner if you so choose. If the jitted code is suboptimal, you can certainly open an issue on that. |
Beta Was this translation helpful? Give feedback.
Correct, although I would argue it's more that's it's more declarative than less text. I don't know what the parameters to slice are. Length? Start? Finish? But ranges are a well known construct.
The runtime team works very hard to make sure that isn't the case. They definitely will treat it as a bug if the Jit output is worse.