Object Collection: Windows Phone Apps Development Turorial – Part 14



RECOMMENDED: Click here to fix Windows errors and optimize system performance

This is how we are now in the 14th part of our Windows Phone 7.5 Mango application development tutorial series. In our previous tutorial, we looked at namespaces. In this section, we take a look at collections of objects. Then let’s get started.

A Collection is simply an object that can handle references to multiple instances of other classes. In short it keeps track of other objects. There are different types of collections under the.NET framework. Some collections allow you to sort objects, while others can help you find objects easily. Collections are always used when several objects are handled.

We now take a look at a kind of collection called List collection.



April 2021 Update:

We now recommend using this tool for your error. Additionally, this tool fixes common computer errors, protects you against file loss, malware, hardware failures and optimizes your PC for maximum performance. You can fix your PC problems quickly and prevent others from happening with this software:

  • Step 1 : Download PC Repair & Optimizer Tool (Windows 10, 8, 7, XP, Vista – Microsoft Gold Certified).
  • Step 2 : Click “Start Scan” to find Windows registry issues that could be causing PC problems.
  • Step 3 : Click “Repair All” to fix all issues.

download



Create a new project with a unique name, like’CollectionsDemo’. In design mode, drag a button to the upper left corner of the emulator (see image). Name the button correctly and set its content to ‘Click Me’. Follow the same procedure for a text block and set its text property to blank. Set the Text Wrap property of the text block to Wrap.

Now create a class Car with two attributes, namely the Make and Model of string data type. For more information, see Understanding and Creating Classes to Create Classes. Now double-click the Click Me button in the MainPage.xaml file design window to open the C# code for the Click button event. Copy and paste the following code into the Click event of your button.

In the first nine lines of the code, we create three different car class objects with the names car1, car2 and car3 and define their attributes.

The following line of code generates a list c

RECOMMENDED: Click here to troubleshoot Windows errors and optimize system performance

Related Video