Hello, I read that C# allow 2 types: value and reference. Class object are always reference types; "struct" and base type (int, float, bool) are value types; but I read that if I embed any value types in a reference type (eg an int32 inside a class declaration), all goes on the heap (even the int32); outside of an object that int32 should go on the stack (the variable with its value).
Qt Code:
  1. class Program {
  2. struct Address {
  3. public Address (string v, int n) {
  4. this.street = v;
  5. this.number = n;
  6. }
  7. internal string street;
  8. internal int number;
  9. };
  10. Address addr = new Address ("donner",99);
  11. public Int32 m = 9;
  12. static void Main(string[] args) {
  13. System.Int32 i = 99;
  14. }
  15. }
To copy to clipboard, switch view to plain text mode 
Above I see 'm' and 'addr' be value types: it should be on the stack. But reading better I can see that they're inside the class 'Program'; I think that Someone create an instance of class 'Program' (I don't know who and where); but the question is: in the manner of C#, every type is inside a Class declaration; so everything goes on the heap; but I know that it isn't possible; then, what happen exactly??? I hope you understand...
thanks..