博文

目前显示的是标签为“value”的博文

"this" in C#

1.Indexers Indexers allow instances of a class or struct to be indexed just like arrays. 2.Extension Methods Extension methods enable you to "add" methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type. The most common extension methods are the LINQ standard query operators that add query functionality to the existing System.Collections.IEnumerable and System.Collections.Generic.IEnumerable<T> types. https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/indexers/ https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/extension-methods https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/params ------------------------- 1.Indexers using System; class SampleCollection<T> {    // Declare an array to store the data elements.    private T[] arr = new T[100];    // Define the indexer to allow client code to us...