C# (C Sharp) programming
По всем вопросам- @notxxx1 Реестр РКН: https://clck.ru/3Fk3kb #VRHSZ
Show more📈 Analytical overview of Telegram channel C# (C Sharp) programming
Channel C# (C Sharp) programming (@csharp_ci) in the Russian language segment is an active participant. Currently, the community unites 18 307 subscribers, ranking 7 335 in the Technologies & Applications category and 36 870 in the Russia region.
📊 Audience metrics and dynamics
Since its creation on невідомо, the project has demonstrated rapid growth, gathering an audience of 18 307 subscribers.
According to the latest data from 15 June, 2026, the channel demonstrates stable activity. Although there has been a change in the number of participants by -14 over the last 30 days and by 0 over the last 24 hours, overall reach remains high.
- Verification status: Not verified
- Engagement rate (ER): The average audience engagement rate is 19.46%. Within the first 24 hours after publication, content typically collects 7.27% reactions from the total number of subscribers.
- Post reach: On average, each post receives 3 563 views. Within the first day, a publication typically gains 1 331 views.
- Reactions and interaction: The audience actively supports content: the average number of reactions per post is 0.
- Thematic interests: Content is focused on key topics such as .net, api, логика, архитектура, string.
📝 Description and content policy
The author describes the resource as a platform for expressing subjective opinions:
“По всем вопросам- @notxxx1
Реестр РКН: https://clck.ru/3Fk3kb
#VRHSZ”
Thanks to the high frequency of updates (latest data received on 16 June, 2026), the channel maintains relevance and a high level of publication reach. Analytics show that the audience actively interacts with content, making it an important point of influence in the Technologies & Applications category.
Foo foo = new Foo();
Bar bar = new Bar();
Baz baz = new Baz();
Console.WriteLine($"{foo.a}, {bar.a}, {baz.a}");
record struct Foo(int a = 10);
struct Bar
{
public Bar(int a = 10)
{
this.a = a;
}
public int a { get; }
}
record class Baz(int a = 10);interface IList<T>
{
T GetHead();
}
В отличие от параметрического полиморфизма, специальный полиморфизм привязан к типу. В зависимости от него вызываются разные реализации метода. Перегрузка методов — один из примеров ad-hoc-полиморфизма. Например, можно иметь две версии метода, присоединяющего первый элемент ко второму — одну, которая принимает два целых числа и складывает их, и другую, которая принимает две строки и конкатенирует их. Вы знаете, что 2 + 3 = 5, но "2" + "3" = "23".
class Appender
{
public int AppendItems(int a, int b) =>
a + b;
public string AppendItems(string a, string b) =>
$"{a}{b}";
}
При полиморфизме подтипов дочерние классы предоставляют разные реализации метода некоторого базового класса. В отличие от специального полиморфизма, где решение о том, какая реализация вызывается, принимается на этапе компиляции (раннее связывание), в полиморфизме подтипов оно принимается во время выполнения (позднее связывание).
abstract class Animal
{
public abstract int GetMeatMass();
}
class Cow : Animal
{
public override int GetMeatMass() => 20;
}
class Dog : Animal
{
public override int GetMeatMass() => 5;
}
Теперь давайте ближе рассмотрим ad-hoc-полиморфизм, два других рассматривать подробно в этот раз не будем.
📌 Читать дальше
@csharp_ciНативная интеграция. Информация о продукте www.otus.ruIWebElement loginButton = driver.FindElement(By.Id("login-button"));
loginButton.Click();
Ввод текста в поле для поиска
IWebElement searchBox = driver.FindElement(By.Name("search"));
searchBox.SendKeys("Selenium testing");
Выбор опции "Черный" из выпадающего списка цветов
IWebElement colorDropdown = driver.FindElement(By.Id("color-selector"));
SelectElement colorSelect = new SelectElement(colorDropdown);
colorSelect.SelectByText("Черный");
Вход на сайт и проверка успешной авторизации
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
[TestFixture]
public class LoginTests
{
IWebDriver driver;
[SetUp]
public void SetUp()
{
driver = new ChromeDriver();
driver.Navigate().GoToUrl("https://www.example.com/login");
}
[Test]
public void TestSuccessfulLogin()
{
IWebElement usernameInput = driver.FindElement(By.Id("username"));
IWebElement passwordInput = driver.FindElement(By.Id("password"));
IWebElement loginButton = driver.FindElement(By.Id("login-button"));
usernameInput.SendKeys("myUsername");
passwordInput.SendKeys("myPassword");
loginButton.Click();
IWebElement welcomeMessage = driver.FindElement(By.CssSelector(".welcome-message"));
Assert.AreEqual("Welcome, User!", welcomeMessage.Text);
}
[TearDown]
public void TearDown()
{
driver.Quit();
}
}
📌 Читать дальше
@csharp_ciclass Singleton
{
private static Singleton instance;
private Singleton()
{}
public static Singleton getInstance()
{
if (instance == null)
instance = new Singleton();
return instance;
}
}
В классе определяется статическая переменная - ссылка на конкретный экземпляр данного объекта и приватный конструктор. В статическом методе getInstance() этот конструктор вызывается для создания объекта, если, конечно, объект отсутствует и равен null.
Для применения паттерна Одиночка создадим небольшую программу. Например, на каждом компьютере можно одномоментно запустить только одну операционную систему. В этом плане операционная система будет реализоваться через паттерн синглтон:
class Program
{
static void Main(string[] args)
{
Computer comp = new Computer();
comp.Launch("Windows 8.1");
Console.WriteLine(comp.OS.Name);
// у нас не получится изменить ОС, так как объект уже создан
comp.OS = OS.getInstance("Windows 10");
Console.WriteLine(comp.OS.Name);
Console.ReadLine();
}
}
class Computer
{
public OS OS { get; set; }
public void Launch(string osName)
{
OS = OS.getInstance(osName);
}
}
class OS
{
private static OS instance;
public string Name { get; private set; }
protected OS(string name)
{
this.Name=name;
}
public static OS getInstance(string name)
{
if (instance == null)
instance = new OS(name);
return instance;
}
}
Синглтон и многопоточность
При применении паттерна синглтон в многопоточным программах мы можем столкнуться с проблемой, которую можно описать следующим образом:
static void Main(string[] args)
{
(new Thread(() =>
{
Computer comp2 = new Computer();
comp2.OS = OS.getInstance("Windows 10");
Console.WriteLine(comp2.OS.Name);
})).Start();
Computer comp = new Computer();
comp.Launch("Windows 8.1");
Console.WriteLine(comp.OS.Name);
Console.ReadLine();
}
Здесь запускается дополнительный поток, который получает доступ к синглтону. Параллельно выполняется тот код, который идет запуска потока и кторый также обращается к синглтону. Таким образом, и главный, и дополнительный поток пытаются инициализровать синглтон нужным значением - "Windows 10", либо "Windows 8.1". Какое значение сиглтон получит в итоге, пресказать в данном случае невозможно.
Вывод программы может быть такой:
Windows 8.1
Windows 10
Или такой:
Windows 8.1
Windows 8.1
В итоге мы сталкиваемся с проблемой инициализации синглтона, когда оба потока одновременно обращаются к коду:
if (instance == null)
instance = new OS(name);
Чтобы решить эту проблему, перепишем класс синглтона следующим образом:
class OS
{
private static OS instance;
public string Name { get; private set; }
private static object syncRoot = new Object();
protected OS(string name)
{
this.Name = name;
}
public static OS getInstance(string name)
{
if (instance == null)
{
lock (syncRoot)
{
if (instance == null)
instance = new OS(name);
}
}
return instance;
}
}
Чтобы избежать одновременного доступа к коду из разных потоков критическая секция заключается в блок lock.
📌 Статья
@csharp_ci
Available now! Telegram Research 2025 — the year's key insights 
