Jump to content

Talk:Extension method

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by SineBot (talk | contribs) at 15:51, 13 October 2009 (Dating comment by Jacosi - "Added section 'Please clarify option 3'"). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

I've added the section on extension method versioning because it's a very essential point of extension methods. The compiler doesn't prevent having extension methods and instance methods with the same names, and this can lead to behavior changes in code. It's something you'd need to know if you came looking for information on extension methods, and that's why I've added it. I'm happy for anybody to edit the wording, which I'm sure isn't perfect. But wholesale deletion without discussion doesn't really fit with the consensus-building model of Wikipedia. --Kyralessa (talk) 22:03, 4 January 2008 (UTC)[reply]

Sure, it is essential but do you really need to demonstrate it? That an instance method will be chosen over an extension method sums it up all. Why do you think readers will not understand it unless presented with an example? Take a look at other articles where naming conflicts are demonstrated. How many of them provides a detailed repro? And you say versioning problem; on what authority can you claim that it is a "problem" for everyone? We just present the facts here, and leave the conclusion whether it is a problem or heavenly boon to the readers.
I am not against inclusion of code, but your text-book example is what I am against. It doesn't feel like I am reading an encyclopedia but rather a beginners book. I will try an edit. --soum talk 13:02, 5 January 2008 (UTC)[reply]
I want to clean up the wording just a bit, but overall I like that edit. It's more concise, and your wording reflects NPOV better than mine did. --Kyralessa (talk) 16:29, 5 January 2008 (UTC)[reply]

String reverse example

The given code snippet is a good example how you can corrupt Unicode strings. It does not not handle characters outside the Basic Multilingual Plane (supplementary characters or surrogate pairs) correctly. If you reverse such UTF-16 character pairs (surrogates), these characters will be truncated. Further reading: http://code.logos.com/blog/2008/10/how_to_reverse_a_unicode_string_in_c.html —Preceding unsigned comment added by 85.178.92.129 (talk) 17:31, 7 June 2009 (UTC)[reply]

Criticisms/Downsides

Might be good to have a discussion about the criticisms on Extension Methods, e.g. having new code for existing classes in a different location. Or maybe there are no real downsides? —Preceding unsigned comment added by Jdmwood (talkcontribs) 11:30, 8 June 2009 (UTC)[reply]

Similar concepts?

Why is there no mention of similar concepts in areas outside of the CLI? This article gives the impression that .Net is the only place where you can tack on instance methods at runtime, when in reality it's practically as old as OOP. The Obj-C article mentions other languages in it's categories section; this one should too.

Please clarify option 3 (aggregation) in 'Problem' section

Please clarify option 3 ("use aggregation instead of inheritance"). I already added links the words 'aggregation' and 'inheritance', but still the use is not indicated. Jacosi (talk) —Preceding undated comment added 15:49, 13 October 2009 (UTC).[reply]