Skip to main content
added 58 characters in body
Source Link
Salah Akbari
  • 40k
  • 10
  • 85
  • 115

You can replace your default value with Null and then use null-coalescing operator, inside your method. Something like this:

public static string ToSummaryString<T>(this IEnumerable<T> items, string delimiter = null) { var realDelimiter = delimiter ?? Environment.NewLine; } 

As an alternative, you can also use Method-Overloading, as @Dennis_E@Dennis_E also mentioned: write 2 methods; one with the delimiter and one without.

You can replace your default value with Null and then use null-coalescing operator, inside your method. Something like this:

public static string ToSummaryString<T>(this IEnumerable<T> items, string delimiter = null) { var realDelimiter = delimiter ?? Environment.NewLine; } 

As an alternative, you can also use Method-Overloading, as @Dennis_E also mentioned: write 2 methods; one with the delimiter and one without.

You can replace your default value with Null and then use null-coalescing operator, inside your method. Something like this:

public static string ToSummaryString<T>(this IEnumerable<T> items, string delimiter = null) { var realDelimiter = delimiter ?? Environment.NewLine; } 

As an alternative, you can also use Method-Overloading, as @Dennis_E also mentioned: write 2 methods; one with the delimiter and one without.

added 99 characters in body
Source Link
Salah Akbari
  • 40k
  • 10
  • 85
  • 115

You can replace your default value with Null and then use null-coalescing operator, inside your method. Something like this:

public static string ToSummaryString<T>(this IEnumerable<T> items, string delimiter = null) { var realDelimiter = delimiter ?? Environment.NewLine; } 

As an alternative, you can also use Method-OverloadingMethod-Overloading, as @Dennis_E also mentioned: write 2 methods; one with the delimiter and one without.

You can replace your default value with Null and then use null-coalescing operator, inside your method. Something like this:

public static string ToSummaryString<T>(this IEnumerable<T> items, string delimiter = null) { var realDelimiter = delimiter ?? Environment.NewLine; } 

As an alternative, you can also use Method-Overloading, as @Dennis_E also mentioned: write 2 methods; one with the delimiter and one without.

You can replace your default value with Null and then use null-coalescing operator, inside your method. Something like this:

public static string ToSummaryString<T>(this IEnumerable<T> items, string delimiter = null) { var realDelimiter = delimiter ?? Environment.NewLine; } 

As an alternative, you can also use Method-Overloading, as @Dennis_E also mentioned: write 2 methods; one with the delimiter and one without.

added 145 characters in body
Source Link
Salah Akbari
  • 40k
  • 10
  • 85
  • 115

You can replace your default value with Null and then use null-coalescing operator, inside your method. Something like this:

public static string ToSummaryString<T>(this IEnumerable<T> items, string delimiter = null) { var realDelimiter = delimiter ?? Environment.NewLine; } 

As an alternative, you can also use Method-Overloading, as @Dennis_E also mentioned: write 2 methods; one with the delimiter and one without.

You can replace your default value with Null and then use null-coalescing operator, inside your method. Something like this:

public static string ToSummaryString<T>(this IEnumerable<T> items, string delimiter = null) { var realDelimiter = delimiter ?? Environment.NewLine; } 

You can replace your default value with Null and then use null-coalescing operator, inside your method. Something like this:

public static string ToSummaryString<T>(this IEnumerable<T> items, string delimiter = null) { var realDelimiter = delimiter ?? Environment.NewLine; } 

As an alternative, you can also use Method-Overloading, as @Dennis_E also mentioned: write 2 methods; one with the delimiter and one without.

added 118 characters in body
Source Link
Salah Akbari
  • 40k
  • 10
  • 85
  • 115
Loading
added 28 characters in body
Source Link
Salah Akbari
  • 40k
  • 10
  • 85
  • 115
Loading
Source Link
Salah Akbari
  • 40k
  • 10
  • 85
  • 115
Loading