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

Clarification of some serialization (design) issues

I was after clarification of some of serialization issues. I think I know
the answers, but I want to be sure.
1. In a serializable collection class is it mandatory (for serialization) to
have a default Item property that is effectively

indexed by the IList index?

Example 1
---------
Default Public ReadOnly Property Item(Index As Integer) As MyObject
Get
Return DirectCast(List.Item(Index), MyObject)
End Get
End Property
2. Is there ever an occasion when this property is not read-only? If so, do
you have an example?

3. It's possible for the Item property to have an alternative version with
another signature:

Example 2
---------

Default Public ReadOnly Property Item(KeyValue As String) As MyObject
Get
Dim objChild as MyObject

For Each objChild in List
If objChild.KeyValue.Equals(KeyValue) Then
Return DirectCast(List.Item(Index), MyObject)
End If
Next

Return Nothing
End Get
End Property

but an integer key value (ie KeyValue As Integer in the above) would have
the same signature as Example 1 which rules it out (unless

someone knows better).

So if it's mandatory to have an Item property indexed by the List index,
what's the best practice for returning an object which is

referenced by the key value - which will be more than likely a Primary Key
integer value from SQL Server?
TIA

Crispin

PS The web based newgroup system was having a few problems. Apologies if
this post turns up more than once.

Nov 21 '05 #1
1 991
Crispin,
I was after clarification of some of serialization issues. I think I know
the answers, but I want to be sure.


This is a newsgroup done by individuals, not by Microsoft. All messages are
given "as is" you never will be sure when somebody gives you an answer, it
is too help you to find a solution or to discuss to find together good
solutions.

In my opinion can only testing by yourself make your "sure".

Cor
Nov 21 '05 #2

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

Similar topics

1
by: Xing Zhou | last post by:
It seems that XmlSerializer.FromTypes() method cannot handle inner class properly .. or is there anything I did wrong? The following code will throw a reflection exception at FromTypes() method....
1
by: Maheal | last post by:
I have been trying to Serialize an object that is the child of another object which is also serializable. Here is the simplified scenario (assume missing code is correct): class One :...
2
by: Hasani | last post by:
If I have a base class that is derived from many classes, and I want to make all the classes serializable. Is there a way I can do this from the base class or must I add to every class, even if...
5
by: Perecli Manole | last post by:
I have a class that has been serialized and saved to disk. I am trying to deserialize it back into the same class which now has an extra private member. It will not deserialize because its...
1
by: CrispinH | last post by:
I was after clarification of some of serialization issues. I think I know the answers, but I want to be sure. 1. In a serializable collection class is it mandatory (for serialization) to have...
1
by: CrispinH | last post by:
I was after clarification of some of serialization issues. I think I know the answers, but I want to be sure. 1. In a serializable collection class is it mandatory (for serialization) to have...
4
by: Michael Maes | last post by:
Hi, How would I make a class implementing a Singleton Pattern serializable. My problem is the Singleton Pattern 'requires' the constructor to be Private and serialization requires the...
8
by: Sharktbbtfy | last post by:
Hi, hoping someone can help. The situation is that an app I designed is installed on a desktop PC and six laptops,separately, which synchronise to the desktop once a day at random times. I...
2
by: =?ISO-8859-1?Q?=22Andr=E9s_G=2E_Aragoneses_=5B_kno | last post by:
Hello. I have this kind of object: class classA { int x; classA z; public int X { get { return this.x; }
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: 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...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.