- For individual users
- Instant access to solutions
- Ask your tech questions
- Start your 30-day Free Trial
Main Topics
Browse All TopicsHello all you experts. Boy, do I need your help. I'm trying to convert a java project to .net and I'm having one problem that is killing me. It concerns the DictionaryEntry struct. No matter what I do, I cannot inherit from it. Now, I understand why (because M$ seals freaking everything!), but I don't understand why, if I copy the DictionaryEntry struct into my file, and then use this struct instead, I'm still getting the same error. I don't know if it's because it's a struct and not an actual class...I mean, as you can see from the code of the DictionaryEntry class/struct, there are only two properties and no methods per se--so I can't add virtual to any of the properties, right?
public struct DictionaryEntry
{
// Instance fields.
private Object key_;
private Object value_;
// Construct a dictionary entry.
public DictionaryEntry(Object key, Object value)
{
if(key == null)
{
throw new ArgumentNullException("key
}
key_ = key;
value_ = value;
}
// DictionaryEntry properties.
public Object Key
{
get
{
return key_;
}
set
{
if(value == null)
{
throw new ArgumentNullException("val
}
key_ = value;
}
}
public Object Value
{
get
{
return value_;
}
set
{
value_ = value;
}
}
My question is, how do I change the above code so I can derive classes from the DictionaryEntry class?
This is obviously a question that only CSharp experts (compared to me anyway!) would know, so I'm offering 500 points to the expert who can print the above code with the changes so I can subclass it...Thanks so much for your help!
This question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership