datamember Questions

2

I am translator in company and often we have problem to understand the difference between the terms "data member" and "field". Could you please describe what they are and how th...
Flirt asked 14/12, 2023 at 10:55

2

We are creating RestService with Asp.Net WebApi. But for some reason Name property is ignored in DataMember attribute when trying to deserialize complex property with [FromURI] attribute. For exa...
Brittaneybrittani asked 9/11, 2015 at 15:8

8

I am very confused about the DataContract attribute in WCF. As per my knowledge it is used for serializating user defined type like classes. I wrote one class which is exposed at client side like t...
Nakitanalani asked 29/1, 2011 at 11:49

8

Solved

Suppose I have a class with private memebers ptr, name, pname, rname, crname and age. What happens if I don't initialize them myself? Here is an example: class Example { private: int *ptr; strin...

4

Solved

I have a datacontract like this [DataContract] class MyDC { [DataMember] public string DM1; [DataMember] public string DM2; [DataMember] public string DM3; } and sometimes I want to pre...
Preglacial asked 29/7, 2010 at 0:10

6

We are running into a situation on an MVC3 project with both the Microsoft JSON serializers and JSON.NET. Everybody knows DateTime's are basically broken in Microsoft's serializers, so we switched...
Preiser asked 15/6, 2012 at 17:7

5

Solved

I have a server side class which I make available on the client side through a [DataContract]. This class has a readonly field which I'd like to make available through a property. However, I'm unab...
Thermostatics asked 9/12, 2009 at 13:2

3

Solved

Is there a way to choose default values of attributes that are not in the xml file during deserialization? If the mAge attribute is not present in the xml file, I want to use a default value of 18....
Meed asked 19/12, 2011 at 19:12

18

Solved

A while ago, I came across some code that marked a data member of a class with the mutable keyword. As far as I can see it simply allows you to modify a member in a const-qualified member method: c...
Morion asked 19/9, 2008 at 19:58

3

I am looking to place attributes on my WCF data contract members to validate string length and possibly use regex for more granular parameter validation. I can the [Range] attribute for numeric a...
Crass asked 15/10, 2012 at 14:35

2

Solved

I was wondering about a possible way to make memory layout of a class to be more effective in templated code. As far as I know, Standard mandates data members of a class to be laid out in memory on...
Pebbly asked 24/9, 2013 at 7:9

2

I have a .Net Web Service function that can accept one string. That function will then serialize that string to JSON, but I only want to serialize it if it's value is not "". I found these instru...
Bigamist asked 4/5, 2011 at 11:33

5

Solved

My teacher required us to create ID data member that's generated automatically, and once established it can’t be modified. What is the most appropriate type? if the answer is static const int ID; ...
Ritter asked 15/3, 2013 at 10:5

2

I am using a DataContractJsonSerializer and have an issue with the DataMember Name. I made a base class and several derived classes. I need the derived classes because I have different json string...
Capital asked 12/9, 2011 at 19:7

2

Solved

I use [DataMember(IsRequired=true)] to make the DataContract properties required. There doesn't seem to be some IsRequired for the OperationContract parameters. How do I make them required and not ...
Tubercular asked 11/10, 2012 at 9:35

6

I have a few objects I need to perform actions on from different threads in c++. I known it is necessary to lock any variable that may be used by more than one thread at the same time, but what if ...
Hammertoe asked 26/4, 2012 at 13:51

2

Solved

I came across this today in a WCF contract: [DataMember(IsRequired = true)] public DateTime? LastModified { get; set; } What are the consequences of IsRequired = True and a nullable DateTime? T...
Flannery asked 14/10, 2011 at 11:10

5

Solved

C++ methods allow a const qualifier to indicate that the object is not changed by the member function. But what does that mean? Eg. if the instance variables are pointers, does it mean that t...
Handcar asked 28/7, 2011 at 0:6

1

Solved

I would like to add a DataMember to one of my DataContracts. I would like to know how existing servers and clients will behave in the presence of a new DataMember if one of the parties isn't update...
Windburn asked 11/4, 2011 at 16:56

1

Solved

In WCF you can define a contract using the [DataContract] and [DataMember] attributes, like this: [DataContract] public class Sample { [DataMember(EmitDefaultValue = false, IsRequired = false)] ...
Jacynth asked 21/3, 2011 at 19:8

1

Solved

I have created a WCF service which returns IEnumerable<CyberResourceProvisioningAction>. The CyberResourceProvisioningAction type has a property of AccountInformation IEnumerable<CyberRes...
Retractor asked 3/2, 2011 at 20:39

3

Solved

What does it mean to put a DataMemberAttribute on an interface member? How does this affect derived classes?
Excitability asked 25/1, 2011 at 8:48

3

Solved

Is the System.Tuple class supported by WCF's Data Contract Serializer (i.e., can I pass Tuple objects to WCF calls and/or receive them as part or all of the result)? I found this page, but not th...
Runkel asked 28/4, 2010 at 20:21

3

Solved

I am trying to create a class with a read-only Id field, however I am having problems retaining the value when the object passes through the WCF server. I cannot set the [DataMember] attribute on ...
Palinode asked 29/9, 2010 at 13:51

3

Solved

Given struct S { SomeType single_element_in_the_struct; }; Is it always true that sizeof(struct S) == sizeof(SomeType) Or it may be implementation dependent?
Electrode asked 27/8, 2010 at 14:17

© 2022 - 2024 — McMap. All rights reserved.