Download presentation

Presentation is loading. Please wait.

Published byMarquez Smail Modified about 1 year ago

1
List Eka, Erick, Reddy © Sekolah Tinggi Teknik Surabaya 1

2
» Fixed Size » Initialization: int[] abc = new int[10]; » Accessing by its index int tmp = abc[0]; 2 © Sekolah Tinggi Teknik Surabaya

3
» Dynamic Size » Initalization List abc = new List (); » Inserting abc.Add(123); » Accessing by its index int tmp = abc[0]; 3 © Sekolah Tinggi Teknik Surabaya

4
4 » Size ˃Array Fixed Size, but you can use Array.Resize ˃List Dynamic Size

5
» Dimension ˃Array : Support multi dimension Example : ˃List : One Dimension But we can make it multi too 5 © Sekolah Tinggi Teknik Surabaya

6
» Function Built In » Like Sort, Reverse, IndexOf, Find, etc ˃Array Use System.Array function ˃List Use its own function 6 © Sekolah Tinggi Teknik Surabaya

7
» Prepare the object to test » Performance test in inserting, updating, and select element. » Using Stopwatch class from System.Diagnostics. 7 © Sekolah Tinggi Teknik Surabaya

8
8 » List is slower than Array when inserting, because List resize its length first

9
9 © Sekolah Tinggi Teknik Surabaya

10
10 © Sekolah Tinggi Teknik Surabaya » When updating its element, list is much faster than array.

11
11 © Sekolah Tinggi Teknik Surabaya

12
12 © Sekolah Tinggi Teknik Surabaya » List is 4 times faster than array when selecting its element.

13
13 © Sekolah Tinggi Teknik Surabaya

14
» Knowing its size, and its size rarely change » Just do basic thing with its element 14 © Sekolah Tinggi Teknik Surabaya

15
» Wanting a dynamic array » Need a lot of function built in ˃Need to remove one or more of its element ˃AddRange function 15 © Sekolah Tinggi Teknik Surabaya

16
» Let’s create List class with array ! 16 © Sekolah Tinggi Teknik Surabaya

17
» Arrays Tutorial, us/library/aa288453(v=vs.71).aspx, accessed on April 5 th us/library/aa288453(v=vs.71).aspx » C# List, accessed on April 5 th © Sekolah Tinggi Teknik Surabaya

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google