Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1098951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:39:31+00:00 2026-05-17T00:39:31+00:00

I have a class Foo marked [Serializable] and implementing ISerializable . I’m trying to

  • 0

I have a class Foo marked [Serializable] and implementing ISerializable. I’m trying to serialize it via DataContractSerializer. In GetObjectData I do this:

info.AddValue("Test", new[] { 1,2,3});

It fails with:

Element ‘:Test’ contains data of the ‘http://schemas.microsoft.com/2003/10/Serialization/Arrays:ArrayOfint’ data contract. The deserializer has no knowledge of any type that maps to this contract. Add the type corresponding to ‘ArrayOfint’ to the list of known types – for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to DataContractSerializer.

I tried passing a knownTypes arg to the DataContractSerializer constructor – didn’t help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T00:39:32+00:00Added an answer on May 17, 2026 at 12:39 am

    Passing a knownTypes arg to the DataContractSerializer constructor will not help. Instead, add [KnownType(typeof(int[]))] to class Foo itself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to do something a bit unusual... I have this class Foo :
Suppose I have class like this (simplified): class Foo_p; class Foo { private: Foo_p
Suppose I have a class called Foo . This class will be modified by
Working with C# Generics you can have a class like this: class Foo<T> where
I have a class called Foo that looks like this: class Foo < ActiveRecord::Base
I have class function Foo(a) { this.a = a; this.bar = function () {
I have: class Foo; class Bar { Foo foo; Bar(): foo(foo) {}; } Bar
I have: class Foo { int a; int b; std::string s; char d; };
I have class Foo(): function bar(): pass function foobar(): pass Rather than executing each
if i have class foo { int a int b } and a List<foo>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.