I have a method that looks like this:
T[] field; public Method(IList<T> argument) { this.field = (T[])argument; }
When the method body is executed, does the enumeration occur during translation? Will this change if the base type is different?
No, he will not list anything. This will either succeed if argumentit is T[], or throw an exception InvalidCastExceptionif it is not. (Or return null if argumentnull.)
argument
T[]
InvalidCastException
If it argumentis a reference to an array (of type T), then there is no enumeration - this is a simple actor.
T
argument List<T> , IList, . ( , T[] - , ).
List<T>
: , , .
Source: https://habr.com/ru/post/1737166/More articles:Time synchronization through a web service call - synchronizationFreeware for viewing multi-valued databases / Unidata - unidataWPF - ListBox ignores style when ItemsSource is bound - stylingRuby DSL experience? - ruby | fooobar.comrequire_once at the beginning or when is it really necessary? - performanceОпределение типа файла локального файла (тип содержимого) с помощью PHP - content-typecreate and write to a text file in vb.net - .netSingle skipping multiple spaces is replaced by single spaces and eliminates spaces and spaces - cHow to post Facebook fan pages on a wall from an external site from which you are a fan but not an administrator - asp.netМожете ли вы пройти аутентификацию в SSAS с учетными записями AD LDS (ADAM)? - sql-server-2008All Articles