473,383 Members | 1,822 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

improving interface member functions of existing class (standard control)

I want to extend an existing class (a standard control), by making
more member functions, to improve the ease of its use. *I don't want
to make my own control, or add new functionality.* I just want to
improve the *interface* for existing functionality.

So, instead of doing this:
MyUnit.MyFunction(Control, ...)

I want:
Control.MyFunction(...)

So, I could inherit, but I doubt the above would work. I'd have to
actually make them the NEW control. Again, I don't want a NEW control
with NEW functionality. I just want to improve the interface to
controls that already exist. And it's ugly to have to make my own
unit and with my own function that has to accept the control as a
parameter each time...

Any ideas?

Zytan

Feb 9 '07 #1
2 1224
In article <11********************@j27g2000cwj.googlegroups.c om>,
zy**********@yahoo.com says...
I want to extend an existing class (a standard control), by making
more member functions, to improve the ease of its use. *I don't want
to make my own control, or add new functionality.* I just want to
improve the *interface* for existing functionality.
In 1.1 or 2.0, I don't see an easy way of doing that if you're ruling
out inheritence.

In future versions of .NET, what you're describing sounds like
"extension methods":

http://tinyurl.com/yoddc9

--
Patrick Steele
http://weblogs.asp.net/psteele
Feb 12 '07 #2
In 1.1 or 2.0, I don't see an easy way of doing that if you're ruling
out inheritence.

In future versions of .NET, what you're describing sounds like
"extension methods":

http://tinyurl.com/yoddc9
Wow, Patrick, this is precisely what I am asking about! So, it
doesn't exist, yet. Too bad. Very cool that they are working on it.

I realize that I didn't really explain very well what I wanted, but
you followed me, anyway. What I was actually looking to do was to add
methods to the RichTextBox class to allow EASY writing of formatted
text in a way that is intuitive to a user that knows nothing about its
internals. For instance, i want the next line printed in bolded red.
It's not so easy (AFAIK), so I made a class to handle it, and these
methods should be natively accessible via IntelliSense as this article
on Extension Methods describes. Very cool.

Zytan

Feb 12 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Roy Pereira | last post by:
I have an application that is composed of a set of "Content" dlls and a viewer application. The viewer calls a standard set of functions that are present in all the dlls. I maintain this by...
9
by: Anon Email | last post by:
Hi people, I'm learning about header files in C++. The following is code from Bartosz Milewski: // Code const int maxStack = 16; class IStack
4
by: lovecreatesbeauty | last post by:
How many member functions will be predefined (provided by compilers implicitly) and called by standard-compliant compilers for a class? Does such a list be given in iso/iec 14882? Which member...
3
by: Christof Warlich | last post by:
Hi, I'm looking for a more concise way than below to extend an existing interface. Just imagine that class Interface would have 1000 other members and class DerivedInterface only needs to add...
21
by: Helge Jensen | last post by:
I've got some data that has Set structure, that is membership, insert and delete is fast (O(1), hashing). I can't find a System.Collections interface that matches the operations naturally offered...
6
by: Bill Rubin | last post by:
The following code snippet shows that VC++ 7.1 correctly compiles a static member function invocation from an Unrelated class, since this static member function is public. I expected to compile the...
0
by: YellowFin Announcements | last post by:
Introduction Usability and relevance have been identified as the major factors preventing mass adoption of Business Intelligence applications. What we have today are traditional BI tools that...
52
by: Ben Voigt [C++ MVP] | last post by:
I get C:\Programming\LTM\devtools\UselessJunkForDissassembly\Class1.cs(360,27): error CS0535: 'UselessJunkForDissassembly.InvocableInternals' does not implement interface member...
20
by: J de Boyne Pollard | last post by:
MThe library functions which are included to allow process Mlaunch, forking, and termination, imply that it is both Mpossible and desirable for a process to fork itself. This is Ma fundamental...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.