TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
djmikeymike
NA
1
0
C# Generic Class - change type parameter.
Mar 28 2007 11:02 PM
Hi All,
I am on a learning curve from .net 1.1 to 2.0 and I am trying to get my head around generics.
As an excercise I am trying to create a linked list that can store data of multiple types.
As such I have created
class
Node
<nodeDataType>
and
class
MyLinkedList
I want to use the list class like this:
MyLinkedList
ll =
new
MyLinkedList
();
ll.append<
string
>(
"foo"
);
ll.append<
Exception
>(
new
Exception
());
ll.append<
short
>(-11);
My problem is this:
The
MyLinkedList
class needs to store a head node (
private
Node
<???> _headNode;)
which is null when created, and the type of object to be stored is not known until the first item is appended.
Is there a way of specifiying the type of a generic class at runtime or indeed changing the generic class type at runtime?
Cheers,
Mike.
Reply
Answers (
1
)
Bug tracking and TFS?
Removing unknown event handlers - through Reflection?