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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:11:13+00:00 2026-05-17T16:11:13+00:00

In .NET, integer data type is a value type(stack) and String is a reference

  • 0

In .NET, integer data type is a value type(stack) and String is a reference type(heap).

So If a class A has an integer, and a string type object in it, and a class B creates an object of class A, then how will this object of class A be stored in memory? In stack, or in a heap?

This was asked in my Microsoft interview. Need to understand how I fared.

  • 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-17T16:11:13+00:00Added an answer on May 17, 2026 at 4:11 pm

    Eric Lippert just wrote about this:

    It is simply false that the choice of whether to use the stack or the heap has anything fundamentally to do with the type of the thing being stored.

    The true story is:

    “in the Microsoft implementation of C# on the desktop CLR, value types are stored on the stack when the value is a local variable or temporary that is not a closed-over local variable of a lambda or anonymous method, and the method body is not an iterator block, and the jitter chooses to not enregister the value.”

    Most importantly, he stresses that you simply should not care where a type lives. You should care where things of a certain lifetime live.

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

Sidebar

Related Questions

I want to pass an integer value to a form in .Net so that
.NET has a lot of complex data structures. Unfortunately, some of them are quite
In VB.NET CINT(VB.NET) is Integer.Parse in .NET Framework, what is the .NET equivalent for
Does .NET come with a class capable of representing extremely large integers, such as
.NET balanced group regexes make my head explode. I've got this string i'm trying
I need to maintain a legacy VB.NET web application. Data typing is, I would
I'm wondering what the declaration of the data type in bindParam() (or bindValue() )
I am extending some of the basic data types in vb.net for a large
.NET Framework: 2.0 Preferred Language: C# I am new to TDD (Test Driven Development).
.NET, Java and other high level database API's in various language often provide techniques

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.