Lots of times for readability I use "constant_string".Length instead of 15 in my code. For example:
string TextAfterFoo(string s) =>
s.Substring(s.IndexOf("Foo") + "Foo".Length); // a lot more readable than `3`
It would be nice if RyuJIT could optimize this as a JIT-time constant, so a string wouldn't have to actually be loaded and called Length on.
category:cq
theme:basic-cq
skill-level:intermediate
cost:medium
Lots of times for readability I use
"constant_string".Lengthinstead of15in my code. For example:It would be nice if RyuJIT could optimize this as a JIT-time constant, so a string wouldn't have to actually be loaded and called
Lengthon.category:cq
theme:basic-cq
skill-level:intermediate
cost:medium