Prev | Current Page 322 | Next

Guy Fouch?©, Trey Nash

"Accelerated VB 2008"

If the method fails to find the requested value, it returns ??“1. No particular
search algorithm is involved with these methods other than the fact that the former starts
searching from the beginning of the array and the latter starts at the end. To perform a faster
search, you can use the BinarySearch shared method. However, before you can do so, you must
sort your array, which requires that the elements within the array implement IComparable.
Synchronization
The System.Array type offers ICollection and IList to synchronize access to an array or a
collection type that implements ICollection. One of the properties of ICollection is
IsSynchronized, which always returns False for regular arrays. Regular arrays are not synchronized
by default and enforcing such a rule would cause those who don??™t need synchronization
to pay a penalty. Therefore, you must manage synchronization yourself.
The easiest way to manage synchronization is with the System.Monitor class, which you
normally use with the SyncLock keyword. The class allows you to acquire the built-in synchronization
lock on an object. However, instead of acquiring a lock on the array object itself, you
should acquire a lock on the ICollection.SyncRoot object.
Many array and collection implementations are free to return a reference to the actual
container here, but they may not for various reasons.


Pages:
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334
katalog stron dieta light Altanki wierszyki gry on line