Hi Karl,FFF wrote:Guy,
that i see similiar, as long as you "extend" "your" class - but then, why not write the functionality as part of the class directly.
not sure i understand you correctly.
It doesn´t make sense to use "extension methods" to enhance "self" written classes. Consider the following sample:
I´m using enhanced VO Checkbox and Radiobutton classes. Both classes use e.g. the same algorithm to calc rectangles. So the x# "extension method" - the "anchor" class is BUTTON - looks like:
STATIC METHOD CalcTextAndFocusRectangle ( SELF o AS BUTTON , hDC AS PTR , pszCaptionText AS PSZ , struRectText AS _winRECT , struRectFocus AS _winRECT , lMultiLine AS LOGIC ,lCalcFocusRectangle AS LOGIC ) AS VOID PASCAL
...
RETURN
within my Radiobutton and Checkbox classes this method is called like any other method.
self:CalcTextAndFocusRectangle( hDC , ...)
All calculations are done with the given params. So there´s no need to get direct access to any Checkbox or RadioButton specific iVars, which wouldn ´t be possible at all from within such a "extension method"
regards
Karl-Heinz