Results 1 to 4 of 4

Thread: Convert reference types in value type and vice versa

  1. #1
    Join Date
    Jan 2011
    Posts
    15

    Convert reference types in value type and vice versa

    I am a programming student , I we were been told about on how about the value type and reference type variable and I know a bit that the value type are directly stored in the stack and and the reference types are stored in the heap , and there reference is actually stored in a heap whenever any object is created , can anyone tell me is there any means to convert them among each other. please give your suggestions. P.S I use C# and Java programming language .

  2. #2
    Join Date
    May 2009
    Posts
    511

    Re: Convert reference types in value type and vice versa

    If you are talking about the inter conversion of reference types and value type the you can make use of the boxing and unboxing concept . boxing is exchange from value type to object(reference) type. In fact the copy of value type copied from stack to heap locarton .unboxing is turn around process of it that is you can say that from heap memory back to the stack memory.

  3. #3
    Join Date
    Apr 2009
    Posts
    569

    Re: Convert reference types in value type and vice versa

    If talked about the conversion among the value and reference types , This type system merger renders value types with the advantages of object-ness without introducing needless overhead.For codes that dont require int values to function like objects, int values are just 32-bit values. For codes that require int values to act like objects, this ability is available on insist. This ability to take care of value types as objects bridges the breach amid value types and reference types that exists in nearly all languages.

  4. #4
    Join Date
    May 2009
    Posts
    539

    Re: Convert reference types in value type and vice versa

    An unboxing conversion allows an open conversion from type object to any value-type or from some interface-type to any value-type that takes the help of the interface-type. An unboxing process includes of first examining on that the object instance is a boxed value of the provided value-type, and then copying the value out of the object . unboxing change of an object box to a value-type G comprises of executing the expression ((G_Box)box).value.

Similar Threads

  1. Replies: 5
    Last Post: 05-07-2012, 06:49 PM
  2. Changing effort hours in project into days and vice versa
    By aglobal in forum Windows Software
    Replies: 1
    Last Post: 20-04-2011, 06:09 PM
  3. Replies: 5
    Last Post: 10-09-2010, 05:41 PM
  4. How to convert DateTime to Date and vice versa in c#?
    By Madaleno in forum Software Development
    Replies: 4
    Last Post: 05-03-2010, 09:35 PM
  5. Replies: 3
    Last Post: 16-01-2010, 11:52 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,667,540.34181 seconds with 17 queries