c# - Can reference types be allocated on stack? -


consider following code:

class point {    public int position; } 

here int position allocated on heap if value type.

but question opposite scenario,consider following code:

struct person {    public string name; } 

here string name allocated on heap or stack?

tia

no. reference string allocated ever person allocated. string allocated on heap. infact everytime new t t class object allocated on heap.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -