GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — CSharp7Features/CSharp7Console/101RefTypes.cs at master · SteveGoodman/CSharp7Features Expand file tree/ Copy path101RefTypes.csMore file actions 32 lines (28 loc) · 855 Bytes / Copy path101RefTypes.csFile metadata and controls32 lines (28 loc) · 855 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 using System; namespace CSharp7Console { public class RefTypes { //Not available in c# 7 yet /* public ref int Find(int number, int[] numbers) { for (int i = 0; i < numbers.Length; i++) { if (numbers[i] == number) { return ref numbers[i]; // return the storage location, not the value } } throw new IndexOutOfRangeException($"{nameof(number)} not found"); } int[] array = { 1, 15, -39, 0, 7, 14, -12 }; public void RefTypesExample() { ref int place = ref Find(7, array); // aliases 7's place in the array place = 9; // replaces 7 with 9 in the array Console.WriteLine(array[4]); // prints 9 } */ } } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |