C# 5.0: More Than Just Async: Listing 4.

Fixes to the evaluation of named and position

 arguments in C# 5.0.
public static void NamedPositionalBreak()
{
  ShowParams(ReturnValue(1), b: ReturnValue(2), c: ReturnValue(3));
  ShowParams(ReturnValue(1), c: ReturnValue(3), b: ReturnValue(2));
}

public static int ReturnValue(int value)
{
  Console.WriteLine(value);
  return value;
}

public static void ShowParams(int a, int b, int c)
{
}

About the Author

Patrick Steele is a senior .NET developer with Billhighway in Troy, Mich. A recognized expert on the Microsoft .NET Framework, he’s a former Microsoft MVP award winner and a presenter at conferences and user group meetings.

comments powered by Disqus

Featured

Subscribe on YouTube