![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest
Posts: n/a
| Deserialize array as object Hello Newsgroup, I have trouble serializing a data contract that has a data member of type object. At runtime this member carries an array of strings and WCF fails to deserialize this member: Code: [DataContract] public class DC { private object _dcvalue; public DC () {} public DC (object v ) { _dcvalue = v; } [DataMember] public object DCValue { get { return _dcvalue; } set { _dcvalue = value; } } } The WCF Error Trace reads as follows: Type 'System.String[]' with data contract name 'ArrayOfstring:http:// schemas.microsoft.com/2003/10/Serialization/Arrays' is not expected. Add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer. How do I transfer array types in data members of type objects? Thanks in advance for your help! Sebastian Dau. |
| | #2 (permalink) | ||||||||||||
| Guest
Posts: n/a
| RE: Deserialize array as object You'll want to add the known type attribute: [KnownType(typeof(String[]))] to the DCValue DataMember. "sebastian.dau@xxxxxx" wrote:
| ||||||||||||
| | #3 (permalink) |
| Newbie ![]() Join Date: Apr 2008 Vista Enterprise x32
Posts: 1
| Re: Deserialize array as object I have the same problem. But, setting the attribute [KnownType(typeof(String[]))] on a DataMember does not compile. Error 2 Attribute 'KnownType' is not valid on this declaration type. It is only valid on 'class, struct' declarations. I hope someone have a solution for this issue.... |
| |
| |
| |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Writing an array back in to an AD Object | Mark Holland | PowerShell | 7 | 04-23-2008 04:52 AM |
| array or object??? | Ryan | PowerShell | 5 | 03-11-2008 05:41 PM |
| preventing PS from Casting object to an array | Marclown | PowerShell | 3 | 01-31-2008 01:21 PM |
| Creating an array of floats using new-object | Kris | PowerShell | 2 | 11-27-2007 10:56 AM |