C# Language Methods Calling a Method

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Calling a static method:

// Single argument
System.Console.WriteLine("Hello World");  

// Multiple arguments
string name = "User";
System.Console.WriteLine("Hello, {0}!", name);  

Calling a static method and storing its return value:

string input = System.Console.ReadLine();

Calling an instance method:

int x = 42;
// The instance method called here is Int32.ToString()
string xAsString = x.ToString();

Calling a generic method

// Assuming a method 'T[] CreateArray<T>(int size)'
DateTime[] dates = CreateArray<DateTime>(8);


Got any C# Language Question?