Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to serialize static members of a class?

How to serialize static members of a class?

Scheduled Pinned Locked Moved C#
helptutorialquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MohammadAmiry
    wrote on last edited by
    #1

    I want to binary serialize a class, which has only static items (variables & objects of different types) which I use globally in my code. When I want to serialize it, I get the error "'EmailAccount' is a type and cannot be used as an expression" : binformatter.Serialize(filstream, EmailAccount); I even tried to create an object from the class and serialize it. But it seems to only save the instance variables and not the static ones. Is there a way to serialize them?

    D 1 Reply Last reply
    0
    • M MohammadAmiry

      I want to binary serialize a class, which has only static items (variables & objects of different types) which I use globally in my code. When I want to serialize it, I get the error "'EmailAccount' is a type and cannot be used as an expression" : binformatter.Serialize(filstream, EmailAccount); I even tried to create an object from the class and serialize it. But it seems to only save the instance variables and not the static ones. Is there a way to serialize them?

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Do not cross post in multiple forums. It is considered rude and make it very difficult to colaborate on answers. I already answered your question in the VB.NET forum.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007, 2008
      But no longer in 2009...

      H 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Do not cross post in multiple forums. It is considered rude and make it very difficult to colaborate on answers. I already answered your question in the VB.NET forum.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007, 2008
        But no longer in 2009...

        H Offline
        H Offline
        Henry Minute
        wrote on last edited by
        #3

        And I have in Q&A:mad:

        Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” Why do programmers often confuse Halloween and Christmas? Because 31 Oct = 25 Dec.

        M 1 Reply Last reply
        0
        • H Henry Minute

          And I have in Q&A:mad:

          Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” Why do programmers often confuse Halloween and Christmas? Because 31 Oct = 25 Dec.

          M Offline
          M Offline
          MohammadAmiry
          wrote on last edited by
          #4

          Thank you both... I removed the message.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups