Template Metaprograms in c#?

Posted on 2005-04-21
Medium Priority
Last Modified: 2010-04-16
I used to do Template Metaprograms in C++ but i dont see this feature in C#. Is there a way to do it?
I am trying to create a generic function which takes a reffrence to either datagrid, datalist or repeater  and binds it to the datareader. It is the the same function which applies to datagrid, datalist and repeater. Any suggestions?
Question by:Carl3003
1 Comment
LVL 48

Accepted Solution

AlexFM earned 1000 total points
ID: 13840508
Templates will be available in C# 2005.
Currently the best thing available is to find some common base class for all supported classes and write code for it. When necessary, make types check and call functions specific to some class.
For example, .NET collections work with object type, this allows to keep any type in collection. It is like writing some generic code in C++ using void* pointer.

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question