Синтаксис C# – использование оператора :C#

Место общения программистов C#
Ответить
Anonymous
 Синтаксис C# – использование оператора :

Сообщение Anonymous »

Просматривая исходный код .Net, я наткнулся на приведенный ниже метод. Мой вопрос касается синтаксиса, используемого при вызове EqualStartingCharacterCount(). Какова цель : в списке параметров? Как называется этот синтаксис?
internal static int GetCommonPathLength(string first, string second, bool ignoreCase)
{
int commonChars = EqualStartingCharacterCount(first, second, ignoreCase: ignoreCase);

// If nothing matches
if (commonChars == 0)
return commonChars;

// Or we're a full string and equal length or match to a separator
if (commonChars == first.Length
&& (commonChars == second.Length || IsDirectorySeparator(second[commonChars])))
return commonChars;

if (commonChars == second.Length && IsDirectorySeparator(first[commonChars]))
return commonChars;

// It's possible we matched somewhere in the middle of a segment e.g. C:\Foodie and C:\Foobar.
while (commonChars > 0 && !IsDirectorySeparator(first[commonChars - 1]))
commonChars--;

return commonChars;
}

Еще один пример использования :.
public static string[] GetDirectories(string path) => GetDirectories(path, "*", enumerationOptions: EnumerationOptions.Compatible);


Подробнее здесь: https://stackoverflow.com/questions/793 ... f-operator
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C#»