4 ms·
using static That will clean up quite a bit of my code.
by kolbe 12y ago
using static
That will clean up quite a bit of my code.
- alkonaut 12y agoAm I mistaken or did they actually forget to use the "using static" statement in the example? That way it gets really clean and confusing. I'm missing a line that says using static Math.Sqrt;
- electroly 12y agoYou're mistaken, kinda. The syntax wasn't originally "using static", it's just "using" but with a qualified class name instead of a namespace name. The example includes: using System.Math; System.Math is a static class, not a namespace. It doesn't import a single static method, it imports the entire class. However, in the italicized note, you can see they changed their minds after releasing the preview. It's going to be "using static", but they didn't update the example. It will still operate on the entire class and not an individual method though.
- alkonaut 12y agoAh my bad I was looking for an explicit "using static" & forgot math is a static class and not a ns.