C# 7 Quick Syntax Reference by Mikael Olsson

C# 7 Quick Syntax Reference by Mikael Olsson

Author:Mikael Olsson
Language: eng
Format: epub
Publisher: Apress, Berkeley, CA


The extension method is callable for objects of its first parameter type, in this case string, as if it were an instance method of that class. No reference to the static class is needed.class MyApp

{

static void Main() {

string s = "10";

int i = s.ToInt();

}

}

Because the extension method has an object reference, it can use instance members of the class it is extending. However, it cannot use members of any class that is inaccessible due to its access level. The benefit of extension methods is that they enable you to “add” methods to a class without having to modify or derive the original type.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.