473,387 Members | 1,455 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.

property serialisation

Hi ,
i have :

public classA
{

private int id;

public int id{get...,set....)
}

i want to serialize the field id,but i don't want to make him public(it
works like that way).
in the msdn it noted that public properties can be serialize too,but when i
put the[xmlattribute] with the property-it fails.
do i have to make my field public, or i can work just with the property?
thanks
erez
Nov 11 '05 #1
1 1310
erez shalom wrote:
i have :

public classA
{

private int id;

public int id{get...,set....)
}
Actually that's synatax error. You cannot have field and property with the
same name.
i want to serialize the field id,but i don't want to make him public(it
works like that way). Only public members are subject to serialization process.
in the msdn it noted that public properties can be serialize too,but when i
put the[xmlattribute] with the property-it fails.
do i have to make my field public, or i can work just with the property?

Property would be ok. It must be read-write though (both getter and setter
must be defined). And try [XmlAttribute] attribute instead (watch the case).
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #2

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

Similar topics

2
by: unknow | last post by:
I want to do a serialisation in pure C++ but i don't know how. Do you have some useful links ? Thanks
2
by: msnews.microsoft.com | last post by:
Hi Here is another EASY question When you serialise an object in .NET, serialisation adds defaut attributes that I dont care EXEMPLE : <root_test...
1
by: lobrys | last post by:
Hi everybody here is a question I have this class that a want to serialize : Public Class BOO <XmlAttributeAttribute()> Public THING As String <XmlElementAttribute("param")> Public p() As...
2
by: lobrys | last post by:
Hi everybody what are the objets for the folowing XML serialisation : (I have problem with "name" and "datatype") <vehicule type="car"> <name datatype="String">Megane</name> </inventory> ...
2
by: gary | last post by:
Hi, When I serialise a class to XML which has properties I sometimes have properties that are like this - public double SpeedMPH { get { return (double)Math.Round(windSpeed*2.23693629,2); }...
0
by: Mark Ingram | last post by:
Hi, ive got a custom control, it basically has a label and a toolstrip. i can add my control to the toolbox and add it to a form, but i'd really like to be able to let the end developer add items...
2
by: Greg | last post by:
I have a bizarre situation in which serialisation is failing routinely under a specific condition, and I'm wondering if the details ring a bell with anyone here. I have 2 classes that my...
2
by: ashwinij | last post by:
Hello The steps which i am doing in my program 1) I am having an xml file. 2) I am performing some updations in the file using XQueryUtil class from nux package. 3)After that i am...
1
by: OrionLee | last post by:
I am using C# to work with a 3rd party DLL (Nevron Charts), and attempting to serialise it. The serialisation itself is handled somewhere inside the DLL, so to get it to happen you call the Nevron's...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.