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 custom class can be converted to common value type?

How custom class can be converted to common value type?

Scheduled Pinned Locked Moved C#
questionhelp
2 Posts 2 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.
  • F Offline
    F Offline
    Faisal Khatri
    wrote on last edited by
    #1

    Hi, I am studying for MCTS and there i have a question fro practise purposes. The question is "Create a custom class that can be converted to common value types"? I have been trying to solve this since 1 week but can not get the soluution of it. Can any one help me with this answer... Thanks in advance Thanks

    C 1 Reply Last reply
    0
    • F Faisal Khatri

      Hi, I am studying for MCTS and there i have a question fro practise purposes. The question is "Create a custom class that can be converted to common value types"? I have been trying to solve this since 1 week but can not get the soluution of it. Can any one help me with this answer... Thanks in advance Thanks

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      Faisal Khatri wrote:

      The question is "Create a custom class that can be converted to common value types"?

      It sounds like the question is talking about Serialisation. All types, eventually, boil down to some basic types such as int, string, double, bool etc. For example, a Customer type may consist of an account number, a surname, forename, address (another custom type), etc. Account number could just be an int, while surname and forename are strings. Serialisation (and its counterpart deserialisation) is the process of taking complex types and representing them in a common way so that they can be transferred to other systems or persisted to a storage medium. Probably one of the most common ways to serialise stuff is to use XML, which is at its most basic just a big string. Of course you can come up with your own scheme for serialising a type. Now, whether this is what your tutor wants, I don't know. If they are careless with their vocabulary then it probably is. If they are very careful with their word usage then no. In .NET a "value type" has a very specific meaning, and a string (although immutable and therefore often confused with a value type) isn't a value type. Does this help at all? Or does it just raise more questions?

      *Developer Day Scotland - Free community conference Delegate Registration Open

      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