Can I use DataContract and Serializable together?

I am working on WCF service. My all class are already serialize using [Serializable] attribute but due to "k__BackingField" Property Naming problem I used DataContract and DataMember attribute. so Can i use both attribute together like following:

public class User

  public string Name { get; set; }

  public int UserID { get; set; }

is this correct?

I also got similar solution here. C# automatic property deserialization of JSON

Serializable and DataContract (not versus?)


I found an article on MSDN according to this we can use both attribute DataContract and Serializable together.

With [Serializable], all fields become part of the data contract (unless they are marked with [NonSerialized]). With [DataContract], only members marked with [DataMember] are included. Note that if a type has both [DataContract] and [Serializable] attributes on it, it will use the [DataContract] mapping

if the problem is in naming why don't you use

[XmlElement(ElementName = "Name")]
public string Name { get; set; } 

Need Your Help

c# list<int> how to insert a new value in between two values

c# list

so i have a list where i need to add new values constantly but when i do i need to increment it and insert it in between two values.

Heatmap.js not rendering

javascript jquery google-maps heatmap

I'm attempting to integrate heatmap.js with Google maps to do some visualization work. I referred to this: