Re: Extending System.Drawing.Rectangle...
Chris Anderson <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.winforms |
|---|---|
| Message-ID | <[email protected]> |
> I don't believe delegating would cause any additional cost. Any calls > to the inner Rectangle instance could be inlined by the JIT compiler > (because Rectangle is a value type and thus sealed). +1, especially by the time it gets to the native code > However, I agree that it is cumbersome that you can't simply attach > new operations to existing structures (or classes, actually) - that's > why I like extension methods in C# 3.0, they seem to be a clean way to > do this. (As long as you con't need to add state.) But that's only a > solution for the future, not for now. > > Fabian Do extension methods work on structs? I suggested it as well, but was unsure about their use on structs