Re: Extending System.Drawing.Rectangle...
Chris Anderson <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.winforms |
|---|---|
| Message-ID | <[email protected]> |
You'd probably need to wrap the Rectangle inside a new class and internally use the Rectangle to perform standard Rectangle functionality, tgen add what you want. Of course you wouldn't be able to use the new class *as* a Rectangle where a Rectangle was expected. In .net 3.0 you *might* be able to use extension methods. ( not 100% sure if you can use them on structs, but worth checking) What extra functionality are you looking to add? -----Original Message----- From: "Gyorgy Bozoki"<[email protected]> Sent: 18/04/07 05:30:47 To: "[email protected]"<[email protected]> Subject: [DOTNET-WINFORMS] Extending System.Drawing.Rectangle... Hi all, I have a question about extending structs: I'd like extend System.Drawing.Rectangle such that it keeps all its existing functionality and a set of new public members can be called. Since Rectangle is a structure, it's sealed and cannot be derived from, so that route is obviously out. I could easily create a simple new class that would have all the functionality of Rectangle and the extra functions that I want to add, but I was wondering if doing this to Rectangle itself would even be technically possible (for example during run time, if necessary.) Thanks, Gyorgy Bozoki -----Unmodified Original Message----- Hi all, I have a question about extending structs: I'd like extend System.Drawing.Rectangle such that it keeps all its existing functionality and a set of new public members can be called. Since Rectangle is a structure, it's sealed and cannot be derived from, so that route is obviously out. I could easily create a simple new class that would have all the functionality of Rectangle and the extra functions that I want to add, but I was wondering if doing this to Rectangle itself would even be technically possible (for example during run time, if necessary.) Thanks, Gyorgy Bozoki