|
| 1 | +=========================== |
| 2 | +:mod:`winsdk.system` module |
| 3 | +=========================== |
| 4 | + |
| 5 | +.. class:: Object |
| 6 | + |
| 7 | + A wrapper around the WinRT ``System.Object`` type. |
| 8 | + |
| 9 | + This is the base type of all WinRT runtime objects and cannot be |
| 10 | + instantiated directly. |
| 11 | + |
| 12 | + This type currently has no members. |
| 13 | + |
| 14 | +.. class:: Array(type, [initializer, ] /) |
| 15 | + |
| 16 | + A wrapper around the WinRT ``System.Array`` type. |
| 17 | + |
| 18 | + This type implements the Python sequence protocol. |
| 19 | + |
| 20 | + :param type: |
| 21 | + The type to use for elements of the array. This can be a WinRT |
| 22 | + type or a format string for fundamental types. |
| 23 | + :type type: str or type |
| 24 | + :param initializer: |
| 25 | + An optional iterator of values to use to initialize the array. |
| 26 | + If an integer value is given, an empty array of that size will |
| 27 | + be initialized. For value types, any object supporting the |
| 28 | + CPython buffer protocol with the correct layout can be used |
| 29 | + as an initializer. |
| 30 | + :type initializer: int or iter or buffer |
| 31 | + |
| 32 | + |
| 33 | + Creation examples:: |
| 34 | + |
| 35 | + from winsdk import Array |
| 36 | + from winsdk.windows.foundation import Point |
| 37 | + |
| 38 | + # array of 10 32-bit unsigned integers. |
| 39 | + a1 = Array("I", 10) |
| 40 | + # array of 3 points with initial values |
| 41 | + a2 = Array(Point, [Point(1, 1), Point(2, 2), Point(3, 3)]) |
| 42 | + |
| 43 | + Sequence protocol examples:: |
| 44 | + |
| 45 | + # get the number of elements in the array |
| 46 | + size = len(a1) |
| 47 | + # get the first element of the array |
| 48 | + item = a1[0] |
| 49 | + # get the last element of the array |
| 50 | + item = a1[-1] |
| 51 | + # iterate all items of the array |
| 52 | + for item in a1: ... |
| 53 | + # test for element in array |
| 54 | + if item in a1: ... |
| 55 | + |
0 commit comments