Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Rextester.Program.Main is the entry point for your code. Don't change it.
- //Microsoft (R) Visual C# Compiler version 2.9.0.63208 (958f2354)
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text.RegularExpressions;
- namespace Rextester
- {
- public class Program
- {
- public static void Main(string[] args)
- {
- //Your code goes here
- string[] names = {"John", "Mick", "Jessica", "Nick", "Frank", "James", "Josh"};
- string name1 = names[0]; // первый элемент массива
- string name2 = ArrGetItem<string>(names, 1); // первый элемент массива (index - 1)
- Console.WriteLine("(name1): names[0] = \"{0}\" | (name2): ArrGetItem<string>(names, 1) = \"{1}\"", name1, name2);
- }
- public static T ArrGetItem<T>(T[] sourceArray, int index) => sourceArray[index - 1];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement