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 1021527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:19:27+00:00 2026-05-16T11:19:27+00:00

I want to know why we must set the serializable attribute to save an

  • 0

I want to know why we must set the serializable attribute to save an object in view state.

Also, which type of objects can we store in view state?

  • 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-16T11:19:28+00:00Added an answer on May 16, 2026 at 11:19 am

    ViewState is serialized using binary serialization using ObjectStateFormatter. Quote from the documentation:

    The ObjectStateFormatter class is
    optimized to serialize and format many
    common .NET Framework reference types,
    as well as constants. The following
    table lists the types that are
    optimized.

    Array, DateTime, Int16, String, ArrayList,
    Double, Int32, String [], Boolean, Enum,
    null (Nothing), String.Empty, Byte,
    Hashtable, Pair, Triplet, Char,
    HybridDictionary, Single, Type, Color,
    IDictionary,

    Additionally, while
    conventional string types and string
    arrays are written to and from a
    serialized binary writer unaltered,
    some strings are optimized by creating
    internal string tables. Strings are
    optimized using these tables if the
    string has an associated TypeConverter
    object or if the string is actually an
    instance of the IndexedString class.

    Other types not listed above are
    binary-serialized using a
    BinaryFormatter object if they
    implement the ISerializable interface
    or are decorated with the
    SerializableAttribute attribute. The
    ObjectStateFormatter class is not
    optimized for any of these
    serializable types.

    If the ObjectStateFormatter class
    encounters a type that is not
    serializable, an ArgumentException
    exception is thrown.

    For an object to be binary serializable in the ViewState it needs to be decorated with the [Serializable] attribute. So you can put in ViewState any object that has this attribute. Note that simple types like string, int, float, … can also be placed in ViewState.

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

Sidebar

Related Questions

I want to know which tool can be used to measure the cyclomatic complexity
I want to know if i can create a custom google maps application,on which
I want to know what maximum value I can set and joomla accept in
I want to know how to use variables for objects and function names in
i want to know how to edit a single row (which i select) from
I want to know what is the difference between a query and a view
For example, I want to write overload functions for set_difference which compares the type
Want to know what the stackoverflow community feels about the various free and non-free
I want to know what a virtual base class is and what it means.
I want to know what are the options to do some scripting jobs in

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.