473,394 Members | 1,658 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,394 software developers and data experts.

Inheriting from Pair

I assumed I could inherit from Pair in order to create a friendly interface
to users, while gaining the benefits of the Pair class for saving to the
ViewState
E.g.

[Serializable()]
public class FriendlyPair: Pair
{
public string String1
{
get {return (string)First;}
set {First = value;}
}
public string String2
{
get {return (string)Second;}
set {Second= value;}
}
}

However, when I try to save it to the ViewState, I get this message:
The type 'FriendlyPair' must be marked as Serializable or have a
TypeConverter other than ReferenceConverter to be put in viewstate

It seems to me that it surely is marked Serializable.

The same message occurs even with an explicit conversion:

protected override object SaveViewState()
{
return (Pair)friendlyPair;
}

Why don't I inherit all the benefits of the Pair class?
Nov 16 '05 #1
0 930

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

Similar topics

14
by: Neil Zanella | last post by:
Hello, I would like to ask how come the design of C++ includes std::pair. First of all I don't think many programmers would use it. For starters, what the first and second members are depends...
3
by: Michael Winter | last post by:
This is in IE 6... I'm trying to inherit from built-in JS objects - Array, specifically. However, I'm having some difficulties. I can add array elements to the child object, and when I retrieve...
3
by: JustSomeGuy | last post by:
in the stl map class I see the use of a function pair and make_pair. What is the difference between pair and make_pair? dictionary.insert(std::pair<Key, Value>(k,v)); works as well as: ...
11
by: Noah Coad [MVP .NET/C#] | last post by:
How do you make a member of a class mandatory to override with a _new_ definition? For example, when inheriting from System.Collections.CollectionBase, you are required to implement certain...
2
by: Charles Law | last post by:
I want a set of controls that all have a border, like a group box. I thought I would create a base control containing just a group box from which my set of controls could inherit. Assuming that...
3
by: Alex Satrapa | last post by:
There's some mention in the (old!) documentation that constraints such as foreign keys won't include data from inheriting tables, eg: CREATE TABLE foo ( id SERIAL PRIMARY KEY ); CREATE TABLE...
4
by: Florent Garcin | last post by:
Hello! I would like to use the map structure with a key of Pair<string, string> and an int as the value. Pair is defined as: template <class T1, class T2> class Pair {
11
by: kietzi | last post by:
Hello world, I was wondering whether it would be possible to create a map which uses a pair of ints as key and a float as value. I have used maps with const char* as key, but have so far not been...
10
by: Alex Vinokur | last post by:
Hi, Is it possible to do C++-casting from const pair<const unsigned char*, size_t>* to const pair<unsigned char*, size_t>* ? Alex Vinokur
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.