Collection Expressions in C#12
the old way of initializing arrays:
int[] numbers = new int[] { 1, 2, 3 };
In C#12 we can declare without using new int[]
int[] numbers = { 1, 2, 3 };
C#12 introduces the spread operator (..) which includes elements from other collections.
Example: List (string) colors = ["red", "green", ..existingColors];
#short #shorts #video
http://www.dotnetoffice.com/
Support Us
https://www.buymeacoffee.com/theDotNetOffice : Buy me a Book
Support: https://www.paypal.com/paypalme/theDotnetoffice
Facebook: https://www.facebook.com/TheDotNetOffice
Twitter: https://twitter.com/thedotnetoffice
the old way of initializing arrays:
int[] numbers = new int[] { 1, 2, 3 };
In C#12 we can declare without using new int[]
int[] numbers = { 1, 2, 3 };
C#12 introduces the spread operator (..) which includes elements from other collections.
Example: List (string) colors = ["red", "green", ..existingColors];
#short #shorts #video
http://www.dotnetoffice.com/
Support Us
https://www.buymeacoffee.com/theDotNetOffice : Buy me a Book
Support: https://www.paypal.com/paypalme/theDotnetoffice
Facebook: https://www.facebook.com/TheDotNetOffice
Twitter: https://twitter.com/thedotnetoffice
- Категория
- Программирование на си
Комментариев нет.