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
Net PerfectDev
1.6k
146
4.6k
Serialize a property using System.ComponentModel.DefaultValueAttribute
Nov 8 2020 4:05 PM
Hello,
I try to serialize a n object to xml file.this object containt a property length
[System.Xml.Serialization.XmlAttributeAttribute()]
[System.ComponentModel.DefaultValueAttribute(1D)]
public
double
Length
{
get
{
return
this
.lengthField;
}
set
{
this
.lengthField = value;
}
}
When i give the value 1 to this property it does not displayed. Despite when i tried to affect the value 1.65 or 1.75 it appeared
<Person Attribute1=
"Name"
Attribute2=
"LastName"
Attribute3=
"Age"
Attribute4=
"Price"
>
<Person1 Attribute1Person1=
"NamePerson"
Attribute2Person1=
"LastNamePerson"
/>
<Person2 Attribute1Person2=
"NamePerson"
Attribute2Person2=
"LastNamePerson"
/>
<Person3 Attribute1Person3=
"NamePerson"
Attribute2Person3=
"LastNamePerson"
/>
<Person4 Attribute1Person4=
"NamePerson"
Attribute2Person4=
"LastNamePerson"
/>
</Person>
<Man Attribute1=
"Name"
Attribute2=
"LastName"
Attribute3=
"Age"
Attribute4=
"Price"
length=
"1.75"
>
<Man1 Attribute1Person1=
"NameMan"
Attribute2Person1=
"LastNameMan"
length=
"1.65"
/>
<Man2 Attribute1Person2=
"NameMan"
Attribute2Person2=
"LastNameMan"
/>
<Man3 Attribute1Person3=
"NameMan"
Attribute2Person3=
"LastNameMan"
length=
"1.55"
/>
<Man4 Attribute1Person4=
"NameMan"
Attribute2Person4=
"LastNameMan"
/>
</Man>
<Women Attribute1=
"Name"
Attribute2=
"LastName"
Attribute3=
"Age"
Attribute4=
"Price"
>
<Women1 Attribute1Person1=
"NameWomen"
Attribute2Person1=
"LastNameWomen"
/>
<Women2 Attribute1Person2=
"NameWomen"
Attribute2Person2=
"LastNameWomen"
/>
<Women3 Attribute1Person3=
"NameWomen"
Attribute2Person3=
"LastNameWomen"
/>
<Women4 Attribute1Person4=
"NameWomen"
Attribute2Person4=
"LastNameWomen"
/>
</Women>
How can fix this problem to display Length=1 ?
Reply
Answers (
2
)
Draw rectangle inside panel in c# windows application
Pass data from textbox in USERCONTROL to Datagridview in another USERC