/
aprogrammer
/
dotnet-docs
Обзор
Документация
Войти
/
aprogrammer
/
dotnet-docs
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
docs/fundamentals/runtime-libraries/snippets/System/AppContext/Overview/csharp/V2/Example6.cs
38 строк
1 KB
Genevieve Warren
Add remarks for core types (#38970)
05 янв 2024, 22:14
Не верифицирован
05 янв 2024, 22:14
71d1377
Код
Авторство
О чём код?
// <Snippet6> using System; using System.Reflection; [assembly: AssemblyVersion("2.0.0.0")] public static class StringLibrary2 { public static int SubstringStartsAt(string fullString, string substr) { return fullString.IndexOf(substr, StringComparison.CurrentCulture); } } // </Snippet6> namespace App { // <Snippet7> using System; public class Example2 { public static void Main() { string value = "The archaeologist"; string substring = "archæ"; int position = StringLibrary2.SubstringStartsAt(value, substring); if (position >= 0) Console.WriteLine("'{0}' found in '{1}' starting at position {2}", substring, value, position); else Console.WriteLine("'{0}' not found in '{1}'", substring, value); } } // The example displays the following output: // 'archæ' found in 'The archaeologist' starting at position 4 // </Snippet7> }