C# 1001 notes
Відкрити в Telegram
Регулярные короткие заметки по C# и .NET. Просто о сложном для каждого. admin - @haarrp
Показати більше6 538
Підписники
-224 години
-57 днів
-330 день
Архів дописів
6 538
Asynchronous programming with async, await, Task in C# (part 1)
C# and .NET Framework (4.5 & Core) supports asynchronous programming using some native functions, classes, and reserved keywords.
Before we see what is asynchronous programming, let's understand what is synchronous programming using the following console example.
In the above example, the
LongProcess() method is some long-running task such as reading a file from the server, calling a web API that returns a large amount of data or uploading or downloading a big file. It takes a little longer time to execute (Thread.Sleep(4000) holds it for 4 seconds just to show long execution time). The ShortProcess() is a simple method that gets executed after the LongProcess() method.
The above program executes synchronously. It means execution starts from the Main() method wherein it first executes the LongProcess() method and then ShortProcess() method. During the execution, an application gets blocked and becomes unresponsive (You can see this in Windows-based applications mainly). This is called synchronous programming where execution does not go to next line until the current line executed completely.6 538
Which of the followings does not allow you to use C# static keyword?
6 538
Which of the followings does not allow you to use C# static keyword?
6 538
Конференция для .NET-разработчиков DotNext 2022 Spring — 16-17 июня онлайн, 27 июня офлайн в Санкт-Петербурге
Программа уже готова: суммарно вас ждет 22 доклада о разных сторонах .NET. Например:
✔️ AOT в .NET: как сейчас работает АОТ-компиляция и какие проблемы она поможет решить.
✔️ Apache Kafka: устройство, применение в .NET и сравнение с RabbitMQ.
✔️ Как написать драйвер базы данных: разберем работу с TCP-сокетами, отказоустойчивость и многое другое.
✔️ Слияние микросервисов в монолит: про гибридную архитектуру для одновременной работы с односерверными и многосерверными окружениями.
✔️ Обзор новой версии C# 11 и объяснение полезных фич.
А также — дискуссии после каждого доклада, тематические обсуждения, мини-доклады от партнеров конференции, игры и розыгрыши подарков.
Переходите на сайт конференции за подробностями и билетами.
При покупке воспользуйтесь промокодом
csharpnotes2022JRGpc — он дает скидку на билеты «Online» и «Online + Offline» для частных лиц.6 538
❓What does thread pooling mean?
The collection of threads is known as thread pooling. These threads find application when the tasks are to be performed without disturbing the primary threads. To manage the operations of the threads in the pool, System.Threading.ThreadPool namespace is used.
6 538
❓What does thread pooling mean?
The collection of threads is known as thread pooling. These threads find application when the tasks are to be performed without disturbing the primary threads. To manage the operations of the threads in the pool, System.Threading.ThreadPool namespace is used.
6 538
📝 What is scope of a Protected Internal member variable of a C# class?
The protected internal access specifier allows a class to hide its member variables and member functions from other class objects and functions, except a child class within the same application. This is also used while implementing inheritance.
6 538
📝 What is scope of a Protected Internal member variable of a C# class?
The protected internal access specifier allows a class to hide its member variables and member functions from other class objects and functions, except a child class within the same application. This is also used while implementing inheritance.
6 538
❓What are the different types of serialization?
Following are the three different types of serialization:
- XML serialization: All the public properties are serialized to the XML document.
- SOAP: Any system that understands SOAP can use this serialization. System.Runtime.Serialization is the place where all the classes reside.
- Binary serialization: It is used for the conversion of any code into binary form.
6 538
C# / .NET supports various built-in data structures. Which of the following data structures does not exist as built-in?
6 538
📝 What is the best practice to have best performance using Lazy objects?
You typically use it when you want to instantiate something the first time its actually used. This delays the cost of creating it till if/when it's needed instead of always incurring the cost.
Usually this is preferable when the object may or may not be used and the cost of constructing it is non-trivial.
For example Lazy<T> makes implementing lazy, thread-safe singletons easy.
6 538
❓State the difference between the “throw” and “throw ex” in .NET
The difference between “throw” and “throw ex” is that “throw” is used for preserving original error stack whereas “throw ex” has a throw point through which it can trace the stack. For more accurate, error-free information, the throw is advisable to use.
6 538
The following C# code is using C# Generics. Which is an incorrect explanation?
6 538
📝 Can you create a function in C# which can accept varying number of arguments?
By using the params keyword, you can specify a method parameter that takes a variable number of arguments. No additional parameters are permitted after the params keyword in a method declaration, and only one params keyword is permitted in a method declaration. The declared type of the params parameter must be a single-dimensional array.
6 538
❓State the difference between is and as operators in C#
The difference between is and as an operator in C# is that is the operator is used for checking the compatibility of an object for a given type and returning to the Boolean for the results.Whereas as the operator is used for casting of an object to a type or to a class.
https://youtu.be/IKmRtJcRX_I
Вже доступно! Дослідження Telegram за 2025 — головні інсайти року 
