OP 04 October, 2020 - 08:20 PM
need some help to fix this code
when i try to build show me this error: https://prnt.sc/ut0lt7
Code:
using System;
using System.Runtime.CompilerServices;
public static class Helper2
{
#pragma warning disable CS1750 // A value of type 'int' cannot be used as a default parameter because there are no standard conversions to type 'StringComparison'
public static string Substring(this string @this, string from = null, string until = null, StringComparison comparison = 2)
#pragma warning restore CS1750 // A value of type 'int' cannot be used as a default parameter because there are no standard conversions to type 'StringComparison'
{
int length = (from ?? string.Empty).Length;
int num = (!string.IsNullOrEmpty(from) ? @this.IndexOf(from, comparison) + length : 0);
if (num < length)
{
throw new ArgumentException("from: Failed to find an instance of the first anchor");
}
int num2 = (!string.IsNullOrEmpty(until) ? @this.IndexOf(until, num, comparison) : @this.Length);
if (num2 < 0)
{
throw new ArgumentException("until: Failed to find an instance of the last anchor");
}
return @this.Substring(num, num2 - num);
}
}
when i try to build show me this error: https://prnt.sc/ut0lt7