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
Hakan Axheim
NA
201
32.4k
Problems with deserialize an XML string
Mar 8 2021 7:33 PM
Hi,
I want to deserialize an XML string into two classes. My main class is called Images se below and that class shall reference to another class called Image. As you can see I want a List of Image connected to the Images class. When I deserialize my XML string the List will not be assigned to the values in my XML string. I don't know why. Maybe someone can help me with this problem?
namespace
DataContractSample.DataContract.Model
{
using
System.Collections.Generic;
using
System.Runtime.Serialization;
[DataContract(Name=
"objects"
, Namespace =
""
, IsReference =
true
)]
[KnownType(
typeof
(IList<Image>))]
public
class
Images
{
[DataMember(Name =
"object"
)]
public
IList<Image> ImageList {
get
;
set
; }
}
}
namespace
DataContractSample.DataContract.Model
{
using
System;
using
System.Runtime.Serialization;
[DataContract(Name =
"object"
, Namespace =
""
)]
public
class
Image
{
[DataMember(Name =
"id"
)]
public
Guid Id {
get
;
set
; }
}
}
This is my XML string:
<
objects
>
<
object
>
<
id
>
CF7E7B22-1D3A-4CFE-91F9-F8C5C2DB4069
</
id
>
</
object
>
<
object
>
<
id
>
CF7E7B22-1D3A-4CFE-91F9-F8C5C2DB4070
</
id
>
</
object
>
</
objects
>
Reply
Answers (
2
)
datagridview tab order
Webcam captured image