Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- namespace Boxing
- {
- class Program
- {
- static void Main(string[] args)
- {
- // Pretend this is .Net 1.0
- string chiken = "chicken";
- int fish = 1;
- ArrayList Truck = new ArrayList();
- Truck.Add(chiken);
- Truck.Add(fish); // boxing: value type into object type
- int secondFish = 2;
- Truck[1] = (int) Truck[1] + secondFish; // unboxing: object type into value type
- }
- }
- }
Add Comment
Please, Sign In to add comment