<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Interview on InternetException</title><link>https://internetexception.com/categories/interview/</link><description>Recent content in Interview on InternetException</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Thu, 30 Mar 2023 11:04:03 +0200</lastBuildDate><atom:link href="https://internetexception.com/categories/interview/index.xml" rel="self" type="application/rss+xml"/><item><title>Solid</title><link>https://internetexception.com/2022/10/26/solid/</link><pubDate>Wed, 26 Oct 2022 14:14:41 +0200</pubDate><guid>https://internetexception.com/2022/10/26/solid/</guid><description>&lt;ul&gt;&#10;&lt;li&gt;The single-responsibility principle - piece of software should have only one responsibility&lt;/li&gt;&#10;&lt;li&gt;The open–closed principle - things should be open for extension but closed for modification&lt;/li&gt;&#10;&lt;li&gt;The Liskov substitution principle - changing interface implementation should not brake software&lt;/li&gt;&#10;&lt;li&gt;The interface segregation principle - it is better to have more specialized interfaces than single big one&lt;/li&gt;&#10;&lt;li&gt;The dependency inversion principle - dependencies should be abstracted via interfaces&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/SOLID" target="_blank" rel="noopener noreferrer"&gt;https://en.wikipedia.org/wiki/SOLID&lt;/a&gt;&#10;&lt;/p&gt;</description></item><item><title>.NET/C# interview questions</title><link>https://internetexception.com/2022/10/26/net-c-interview-questions/</link><pubDate>Wed, 26 Oct 2022 10:21:52 +0200</pubDate><guid>https://internetexception.com/2022/10/26/net-c-interview-questions/</guid><description>&lt;ul&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;a href="https://internetexception.com/2022/10/18/idisposable-interface-pattern/" data-type="URL" data-id="/2022/10/18/idisposable-interface-pattern/"&gt;&lt;code&gt;IDisposable&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;a href="https://internetexception.com/2022/10/18/supressfinalize-in-idisposable-interface/" data-type="URL" data-id="/2022/10/18/supressfinalize-in-idisposable-interface/"&gt;&lt;code&gt;SupressFinalize&lt;/code&gt; in &lt;code&gt;IDisposable&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;a href="https://internetexception.com/2022/10/19/asynchronous-programming-in-net/" data-type="URL" data-id="/2022/10/19/asynchronous-programming-in-net/"&gt;Asynchronous programming in .NET&lt;/a&gt;&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;a href="https://internetexception.com/2022/10/19/async-await-in-c/" data-type="post" data-id="491"&gt;&lt;code&gt;async&lt;/code&gt;/&lt;code&gt;await&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;!-- --&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;a href="https://internetexception.com/2022/10/19/avoid-deadlock-with-asynchronous-methods/"&gt;Avoid deadlock with &lt;code&gt;async&lt;/code&gt;/&lt;code&gt;await&lt;/code&gt;&lt;/a&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="http://2022/10/19/does-async-await-creates-new-thread/" target="_blank" rel="noopener noreferrer"&gt;Does &lt;code&gt;async&lt;/code&gt;/&lt;code&gt;await&lt;/code&gt; creates new thread?&lt;/a&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://internetexception.com/2022/10/19/cpu-bound-vs-i-o-bound/"&gt;CPU bound vs I/O bound tasks&lt;/a&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://internetexception.com/2022/10/19/what-is-synchronizationcontext-in-net/"&gt;SynchronizationContext&lt;/a&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://internetexception.com/2022/10/19/thread-vs-task-in-net/"&gt;Threads/tasks&lt;/a&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://internetexception.com/2022/10/19/locking-in-net/" data-type="URL" data-id="/2022/10/19/locking-in-net/"&gt;locking in .NET&lt;/a&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;a href="https://internetexception.com/2022/10/19/locking-with-integer/" data-type="post" data-id="513"&gt;locking with integer&lt;/a&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://internetexception.com/2022/10/19/task-parallel-library-tpl/" data-type="URL" data-id="/2022/10/19/task-parallel-library-tpl/"&gt;TPL&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://internetexception.com/2022/10/19/threadpool/" data-type="URL" data-id="/2022/10/19/threadpool/"&gt;ThreadPool&lt;/a&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;a href="https://internetexception.com/2022/10/19/net-type-system/" data-type="URL" data-id="/2022/10/19/net-type-system/"&gt;Type system&lt;/a&gt;&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;a href="https://internetexception.com/2022/10/19/reference-types-vs-value-types/" data-type="URL" data-id="/2022/10/19/reference-types-vs-value-types/"&gt;Reference types vs value types&lt;/a&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;a href="https://internetexception.com/2022/10/19/value-types-as-fields-in-objects/" data-type="URL" data-id="/2022/10/19/value-types-as-fields-in-objects/"&gt;value types as fields in objects&lt;/a&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;!-- --&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;a href="https://internetexception.com/2022/10/19/what-type-can-not-be-object-field/"&gt;What kind of types cannot be object field?&lt;/a&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://internetexception.com/2022/10/19/ref-struct-types/" data-type="URL" data-id="/2022/10/19/ref-struct-types/"&gt;&lt;code&gt;ref struct&lt;/code&gt; types&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://internetexception.com/2022/10/19/strings-in-net/" data-type="post" data-id="535"&gt;Strings in .NET&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://internetexception.com/2022/10/19/data-structures-in-net/" data-type="post" data-id="537"&gt;Data Structures&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://internetexception.com/2022/10/19/net-generics/" data-type="URL" data-id="/2022/10/19/net-generics/"&gt;Generics&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://internetexception.com/2022/10/19/covariance-and-contravariance/" data-type="post" data-id="541"&gt;Covariance and Contravariance&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://internetexception.com/2022/10/25/equals-and-gethashcode/" data-type="post" data-id="587"&gt;Equals and GetHashCode&lt;/a&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;a href="https://internetexception.com/2022/10/19/garbage-collector/" data-type="post" data-id="545"&gt;Garbage Collector&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Equals and GetHashCode</title><link>https://internetexception.com/2022/10/25/equals-and-gethashcode/</link><pubDate>Tue, 25 Oct 2022 16:36:49 +0200</pubDate><guid>https://internetexception.com/2022/10/25/equals-and-gethashcode/</guid><description>&lt;p&gt;Custom implementation is usually only necessary if default, reference equality is not enough. In example:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;entities value based equality&lt;/li&gt;&#10;&lt;li&gt;value equality of deserialized objects&lt;/li&gt;&#10;&lt;li&gt;custom comparisons based on other criterias&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-csharp" data-lang="csharp"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ImaginaryNumber&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;IEquatable&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;ImaginaryNumber&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;RealNumber&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;ImaginaryUnit&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;override&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="n"&gt;Equals&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;object&lt;/span&gt; &lt;span class="n"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;Equals&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;obj&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;ImaginaryNumber&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="n"&gt;Equals&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ImaginaryNumber&lt;/span&gt; &lt;span class="n"&gt;other&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;other&lt;/span&gt; &lt;span class="p"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="p"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;RealNumber&lt;/span&gt; &lt;span class="p"&gt;==&lt;/span&gt; &lt;span class="n"&gt;other&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RealNumber&lt;/span&gt; &lt;span class="p"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;ImaginaryUnit&lt;/span&gt; &lt;span class="p"&gt;==&lt;/span&gt; &lt;span class="n"&gt;other&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ImaginaryUnit&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;override&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;GetHashCode&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;HashCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Combine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;RealNumber&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ImaginaryUnit&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>Difference between Controller and ControllerBase</title><link>https://internetexception.com/2022/10/25/difference-between-controller-and-controllerbase/</link><pubDate>Tue, 25 Oct 2022 16:28:23 +0200</pubDate><guid>https://internetexception.com/2022/10/25/difference-between-controller-and-controllerbase/</guid><description>&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;Controller&lt;/code&gt; type inherits from &lt;code&gt;ControllerBase&lt;/code&gt; and have Views support&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;ControllerBase&lt;/code&gt; type is better suited for APIs&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/aspnet/core/web-api/?view=aspnetcore-6.0" target="_blank" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/aspnet/core/web-api/?view=aspnetcore-6.0&lt;/a&gt;&#10;&lt;/p&gt;</description></item><item><title>Kestrel</title><link>https://internetexception.com/2022/10/25/kestrel/</link><pubDate>Tue, 25 Oct 2022 15:56:40 +0200</pubDate><guid>https://internetexception.com/2022/10/25/kestrel/</guid><description>&lt;ul&gt;&#10;&lt;li&gt;default application server for .net&lt;/li&gt;&#10;&lt;li&gt;cross platform&lt;/li&gt;&#10;&lt;li&gt;best performance and memory utilization&lt;/li&gt;&#10;&lt;li&gt;may not have some advanced features of HTTP.sys on Windows&lt;/li&gt;&#10;&lt;li&gt;may be used with proxy server or as internet facing server&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel?view=aspnetcore-6.0" target="_blank" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel?view=aspnetcore-6.0&lt;/a&gt;&#10;&lt;/p&gt;</description></item><item><title>ASP.NET Core controller level exception handling</title><link>https://internetexception.com/2022/10/25/asp-net-core-controller-level-exception-handling/</link><pubDate>Tue, 25 Oct 2022 15:53:52 +0200</pubDate><guid>https://internetexception.com/2022/10/25/asp-net-core-controller-level-exception-handling/</guid><description>&lt;p&gt;To handle exceptions on Controller/Action level Exception Filters are used.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-csharp" data-lang="csharp"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;[TypeFilter(typeof(SampleExceptionFilter))]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ExceptionController&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Controller&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Exception Filters are implemented using &lt;code&gt;IExceptionFilter&lt;/code&gt; with &lt;code&gt;OnExcetion&lt;/code&gt; method override to handle exceptions.&lt;/p&gt;&#10;&lt;p&gt;Exception Filters can be applied to Controller and Action level.&lt;/p&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/aspnet/core/mvc/controllers/filters?view=aspnetcore-7.0#exception-filters" target="_blank" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/aspnet/core/mvc/controllers/filters?view=aspnetcore-7.0#exception-filters&lt;/a&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.filters.iexceptionfilter?view=aspnetcore-7.0" target="_blank" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.filters.iexceptionfilter?view=aspnetcore-7.0&lt;/a&gt;&#10;&lt;/p&gt;</description></item><item><title>ASP.NET Core global exception handling</title><link>https://internetexception.com/2022/10/25/asp-net-core-global-exception-handling/</link><pubDate>Tue, 25 Oct 2022 15:49:53 +0200</pubDate><guid>https://internetexception.com/2022/10/25/asp-net-core-global-exception-handling/</guid><description>&lt;p&gt;To add global exception handling in ASP.NET Core just use configuration method:&lt;/p&gt;&#10;&lt;p&gt;&lt;code&gt;app.UseExceptionHandler&lt;/code&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/aspnet/core/fundamentals/error-handling?view=aspnetcore-6.0#exception-handler-lambda" target="_blank" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/aspnet/core/fundamentals/error-handling?view=aspnetcore-6.0#exception-handler-lambda&lt;/a&gt;&#10;&lt;/p&gt;</description></item><item><title>What ASP.NET Middleware can do?</title><link>https://internetexception.com/2022/10/25/what-asp-net-middleware-can-do/</link><pubDate>Tue, 25 Oct 2022 15:45:12 +0200</pubDate><guid>https://internetexception.com/2022/10/25/what-asp-net-middleware-can-do/</guid><description>&lt;p&gt;Pretty much everything. Default ASP.NET Core request handling pipeline is consisting of bunch of middlewares:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/aspnet/core/security/authentication/identity?view=aspnetcore-6.0" target="_blank" rel="noopener noreferrer"&gt;Authentication&lt;/a&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.builder.authorizationappbuilderextensions.useauthorization" target="_blank" rel="noopener noreferrer"&gt;Authorization&lt;/a&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/aspnet/core/security/cors?view=aspnetcore-6.0" target="_blank" rel="noopener noreferrer"&gt;CORS&lt;/a&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/aspnet/core/fundamentals/http-logging/?view=aspnetcore-6.0" target="_blank" rel="noopener noreferrer"&gt;HTTP Logging&lt;/a&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/aspnet/core/mvc/overview?view=aspnetcore-6.0" target="_blank" rel="noopener noreferrer"&gt;MVC&lt;/a&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/aspnet/core/fundamentals/static-files?view=aspnetcore-6.0" target="_blank" rel="noopener noreferrer"&gt;Static Files&lt;/a&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;other&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Whole list of built-in middlewares can be found here:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/aspnet/core/fundamentals/middleware/?view=aspnetcore-7.0#built-in-middleware" target="_blank" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/aspnet/core/fundamentals/middleware/?view=aspnetcore-7.0#built-in-middleware&lt;/a&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;There is possibility to write custom middleware too.&lt;/p&gt;</description></item><item><title>Middleware in OWIN</title><link>https://internetexception.com/2022/10/25/middleware-in-owin/</link><pubDate>Tue, 25 Oct 2022 15:40:45 +0200</pubDate><guid>https://internetexception.com/2022/10/25/middleware-in-owin/</guid><description>&lt;p&gt;There are 2 ways of writing OWIN middleware in ASP.NET Core.&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Pure OWIN - usefull if you want to integrate with OWIN compatible module but not written in C#&lt;/li&gt;&#10;&lt;li&gt;ASP.NET Core OWIN middleware&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="aspnet-core-middleware"&gt;ASP.NET Core Middleware:&lt;/h2&gt;&#10;&lt;p&gt;This type of middleware can be:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;delegate of &lt;code&gt;Func&amp;lt;HttpContext, Func&amp;lt;&lt;/code&gt;Task&amp;gt;&lt;code&gt;, Task&amp;gt;&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;class with &lt;a href="https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.imiddleware?view=aspnetcore-7.0" data-type="URL" data-id="https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.imiddleware?view=aspnetcore-7.0"&gt;&lt;code&gt;IMiddleware&lt;/code&gt;&lt;/a&gt; imlementation&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-csharp" data-lang="csharp"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;async&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;next&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;// Do work that can write to the Response.&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;next&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Invoke&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;// Do logging or other work that doesn&amp;#39;t write to the Response.&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;});&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="pure-owin-middleware"&gt;Pure OWIN Middleware:&lt;/h2&gt;&#10;&lt;p&gt;This rather would be used to integrate with OWIN middlewares written in different language, so that ASP.NET Core implementation directly is not possible.&lt;/p&gt;</description></item><item><title>Owin model and Kestrell request handling</title><link>https://internetexception.com/2022/10/24/owin-model-and-kestrell-request-handling/</link><pubDate>Mon, 24 Oct 2022 15:23:02 +0200</pubDate><guid>https://internetexception.com/2022/10/24/owin-model-and-kestrell-request-handling/</guid><description>&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;OWIN&lt;/strong&gt; - Open Web Interface for .NET&lt;/li&gt;&#10;&lt;li&gt;allows web apps to be decoupled from web servers&lt;/li&gt;&#10;&lt;li&gt;defines standard way for middleware to be used in a pipeline to handle requests and provide responses&lt;/li&gt;&#10;&lt;li&gt;ASP.NET Core applications can interoperate with OWIN-based applications, servers and middleware&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Microsoft.AspNetCore.Owin package provides two adapter implementations:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;ASP.NET Core to OWIN&lt;/li&gt;&#10;&lt;li&gt;OWIN to ASP.NET Core&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;This allows ASP.NET Core to be hosted on top of an OWIN compatible server/host or for other OWIN compatible components to be run on top of ASP.NET Core.&lt;/p&gt;</description></item><item><title>Expression Trees</title><link>https://internetexception.com/2022/10/24/expression-trees/</link><pubDate>Mon, 24 Oct 2022 15:08:43 +0200</pubDate><guid>https://internetexception.com/2022/10/24/expression-trees/</guid><description>&lt;ul&gt;&#10;&lt;li&gt;&amp;rsquo;tree like&amp;rsquo; data structure&lt;/li&gt;&#10;&lt;li&gt;each node is expression (method call, equality comparison, binary operation etc.) representing a piece of code&lt;/li&gt;&#10;&lt;li&gt;you can compile expression tree and run code it represent&lt;/li&gt;&#10;&lt;li&gt;enables dynamic code generation at runtime&lt;/li&gt;&#10;&lt;li&gt;LINQ queries on DBs are implemented with Expression Trees&lt;/li&gt;&#10;&lt;li&gt;used in the dynamic language runtime (DLR)&lt;/li&gt;&#10;&lt;li&gt;anonymous lambda expression can be converted to &lt;code&gt;ExpressionTree&lt;/code&gt; via compiler (i.e. &lt;code&gt;x =&amp;gt; x*2&lt;/code&gt; can be represented as tree instead of delegate or anonymous lambda function)&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;</description></item><item><title>Linq</title><link>https://internetexception.com/2022/10/24/linq/</link><pubDate>Mon, 24 Oct 2022 15:05:47 +0200</pubDate><guid>https://internetexception.com/2022/10/24/linq/</guid><description>&lt;ul&gt;&#10;&lt;li&gt;consistent model for working with data from various kinds of sources and formats (XML, SQL, ADO.NET, Datasets, .NET collections etc)&lt;/li&gt;&#10;&lt;li&gt;3 stages of working with LINQ:&#10;&lt;ul&gt;&#10;&lt;li&gt;obtain data source&lt;/li&gt;&#10;&lt;li&gt;create the query&lt;/li&gt;&#10;&lt;li&gt;execute the query&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;data sources implements &lt;code&gt;IEnumerable&amp;lt;&amp;gt;&lt;/code&gt; and are called &lt;code&gt;queryable types&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;IQueryable&amp;lt;&amp;gt;&lt;/code&gt; interface inherits from &lt;code&gt;IEnumerable&amp;lt;&amp;gt;&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;generally it is better to use LINQ via &lt;code&gt;IQueryable&amp;lt;&amp;gt;&lt;/code&gt; which produces &lt;code&gt;deferred query&lt;/code&gt; instead of producing result immediately&lt;/li&gt;&#10;&lt;li&gt;queries can be executed multiple times&lt;/li&gt;&#10;&lt;li&gt;queries can be forced immediate execution via &lt;code&gt;Count()&lt;/code&gt;, &lt;code&gt;Max()&lt;/code&gt;, &lt;code&gt;ToList()&lt;/code&gt; or &lt;code&gt;ToArray()&lt;/code&gt; etc.&lt;/li&gt;&#10;&lt;li&gt;LINQ to DB libraries (like EntityFramework) usually are implemented via &lt;code&gt;Expression Trees&lt;/code&gt;&lt;/li&gt;&#10;&lt;/ul&gt;</description></item><item><title>Entity Framework: Change Tracking</title><link>https://internetexception.com/2022/10/24/entity-framework-change-tracking/</link><pubDate>Mon, 24 Oct 2022 15:02:09 +0200</pubDate><guid>https://internetexception.com/2022/10/24/entity-framework-change-tracking/</guid><description>&lt;ul&gt;&#10;&lt;li&gt;tracked entities are saved during &lt;code&gt;SaveChanges()&lt;/code&gt; call&lt;/li&gt;&#10;&lt;li&gt;entities being tracked when they are:&#10;&lt;ul&gt;&#10;&lt;li&gt;returned from DB&lt;/li&gt;&#10;&lt;li&gt;attached to context&lt;/li&gt;&#10;&lt;li&gt;added as subentity&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;tracking can be disabled (&lt;code&gt;AsNoTracking()&lt;/code&gt; i.e.)&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/ef/core/change-tracking/" target="_blank" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/ef/core/change-tracking/&lt;/a&gt;&#10;&lt;/p&gt;</description></item><item><title>Entity Framework: eager and lazy loading</title><link>https://internetexception.com/2022/10/24/entity-framework-eager-and-lazy-loading/</link><pubDate>Mon, 24 Oct 2022 14:57:56 +0200</pubDate><guid>https://internetexception.com/2022/10/24/entity-framework-eager-and-lazy-loading/</guid><description>&lt;ul&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;lazy loading:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;delaying load of data until we specifically request for it&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;!-- --&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;i.e. accessing &lt;code&gt;customer.Address&lt;/code&gt; loads Address of a customer in the background via separate SQL query&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;!-- --&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;property needs to be public, virtual&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;!-- --&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;context.Configuration.ProxyCreationEnabled should be true&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;!-- --&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;context.Configuration.LazyLoadingEnabled should be true&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;!-- --&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;to disable lazy loading completely &lt;code&gt;Context.Configuration.LazyLoadingEnabled = false;&lt;/code&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;eager loading&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;opposite of lazy loading&lt;/li&gt;&#10;&lt;li&gt;loads related entities as part of the query&lt;/li&gt;&#10;&lt;li&gt;done via &lt;code&gt;.Include()&lt;/code&gt; query&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;</description></item><item><title>Pattern matching</title><link>https://internetexception.com/2022/10/24/pattern-matching/</link><pubDate>Mon, 24 Oct 2022 14:50:08 +0200</pubDate><guid>https://internetexception.com/2022/10/24/pattern-matching/</guid><description>&lt;p&gt;Pattern matching is used for:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;testing expression to check if some value have certain characteristics&lt;/li&gt;&#10;&lt;li&gt;safer compare because &amp;lsquo;==&amp;rsquo; and &amp;lsquo;!=&amp;rsquo; can be overloaded&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Examples:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-csharp" data-lang="csharp"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;number&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-csharp" data-lang="csharp"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;sequence&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="n"&gt;IList&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;list&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;switch statement:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-csharp" data-lang="csharp"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;command&lt;/span&gt; &lt;span class="k"&gt;switch&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;Operation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SystemTest&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;RunDiagnostics&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;Operation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Start&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;StartSystem&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;Operation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Stop&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;StopSystem&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;Operation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Reset&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;ResetToReady&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;ArgumentException&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Invalid enum value for command&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;nameof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;command&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;};&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;switch with ranges:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-csharp" data-lang="csharp"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;tempInFahrenheit&lt;/span&gt; &lt;span class="k"&gt;switch&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;(&amp;gt;&lt;/span&gt; &lt;span class="m"&gt;32&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="p"&gt;(&amp;lt;&lt;/span&gt; &lt;span class="m"&gt;212&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s"&gt;&amp;#34;liquid&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt; &lt;span class="m"&gt;32&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s"&gt;&amp;#34;solid&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="m"&gt;212&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s"&gt;&amp;#34;gas&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="m"&gt;32&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s"&gt;&amp;#34;solid/liquid transition&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="m"&gt;212&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s"&gt;&amp;#34;liquid / gas transition&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;};&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;collection pattern matching:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-csharp" data-lang="csharp"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;array&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;..]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Further read:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/functional/pattern-matching" target="_blank" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/functional/pattern-matching&lt;/a&gt;&#10;&lt;/p&gt;</description></item><item><title>Reflection</title><link>https://internetexception.com/2022/10/19/reflection/</link><pubDate>Wed, 19 Oct 2022 16:44:33 +0200</pubDate><guid>https://internetexception.com/2022/10/19/reflection/</guid><description>&lt;ul&gt;&#10;&lt;li&gt;obtain information about types and members at runtime&lt;/li&gt;&#10;&lt;li&gt;create instances, invoke or access them&lt;/li&gt;&#10;&lt;li&gt;dynamic code generation&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/framework/reflection-and-codedom/reflection" target="_blank" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/dotnet/framework/reflection-and-codedom/reflection&lt;/a&gt;&#10;&lt;/p&gt;</description></item><item><title>Deployment models</title><link>https://internetexception.com/2022/10/19/deployment-models/</link><pubDate>Wed, 19 Oct 2022 16:42:01 +0200</pubDate><guid>https://internetexception.com/2022/10/19/deployment-models/</guid><description>&lt;table&gt;&#10;&lt;thead&gt;&#10;&lt;tr&gt;&#10;&lt;th&gt;Type&lt;/th&gt;&#10;&lt;th&gt;Command&lt;/th&gt;&#10;&lt;/tr&gt;&#10;&lt;/thead&gt;&#10;&lt;tbody&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/core/deploying/#publish-framework-dependent"&gt;framework-dependent executable&lt;/a&gt; for the current platform.&lt;/td&gt;&#10;&lt;td&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-publish"&gt;&lt;code&gt;dotnet publish&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/core/deploying/#publish-framework-dependent"&gt;framework-dependent executable&lt;/a&gt; for a specific platform.&lt;/td&gt;&#10;&lt;td&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-publish"&gt;&lt;code&gt;dotnet publish -r &amp;lt;RID&amp;gt; --self-contained false&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/core/deploying/#publish-framework-dependent"&gt;framework-dependent binary&lt;/a&gt;.&lt;/td&gt;&#10;&lt;td&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-publish"&gt;&lt;code&gt;dotnet publish&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/core/deploying/#publish-self-contained"&gt;self-contained executable&lt;/a&gt;.&lt;/td&gt;&#10;&lt;td&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-publish"&gt;&lt;code&gt;dotnet publish -r &amp;lt;RID&amp;gt;&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/core/deploying/#publish-framework-dependent" data-type="URL" data-id="https://learn.microsoft.com/en-us/dotnet/core/deploying/#publish-framework-dependent"&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/core/deploying/#publish-framework-dependent" target="_blank" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/dotnet/core/deploying/#publish-framework-dependent&lt;/a&gt;&#10;&lt;/a&gt;&lt;/p&gt;</description></item><item><title>.NET AOT</title><link>https://internetexception.com/2022/10/19/net-aot/</link><pubDate>Wed, 19 Oct 2022 16:39:08 +0200</pubDate><guid>https://internetexception.com/2022/10/19/net-aot/</guid><description>&lt;p&gt;&lt;strong&gt;Ahead of the time&lt;/strong&gt; compilation to machine code&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;produces self-contained application which:&#10;&lt;ul&gt;&#10;&lt;li&gt;starts quicker&lt;/li&gt;&#10;&lt;li&gt;uses less memory&lt;/li&gt;&#10;&lt;li&gt;does not require .NET runtime installed&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;it is better for workloads with high deployment instances (clouds)&lt;/li&gt;&#10;&lt;li&gt;makes runtime code generation impossible&lt;/li&gt;&#10;&lt;li&gt;not all libraries are compatible&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/" target="_blank" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/&lt;/a&gt;&#10;&lt;/p&gt;</description></item><item><title>.NET Jit</title><link>https://internetexception.com/2022/10/19/net-jit/</link><pubDate>Wed, 19 Oct 2022 16:36:28 +0200</pubDate><guid>https://internetexception.com/2022/10/19/net-jit/</guid><description>&lt;p&gt;&lt;strong&gt;Just - in - time&lt;/strong&gt; compiler.&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;part of CLR&lt;/li&gt;&#10;&lt;li&gt;for all .net programs for all .net languages&lt;/li&gt;&#10;&lt;li&gt;converts &lt;strong&gt;MSIL&lt;/strong&gt; to native machine code&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;compiles&lt;/strong&gt; code when it is necessary at &lt;strong&gt;runtime&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;also it is possible to &lt;strong&gt;pre-compile to native code&lt;/strong&gt; at compile time instead&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://www.geeksforgeeks.org/what-is-just-in-time-jit-compiler-in-dot-net/" target="_blank" rel="noopener noreferrer"&gt;https://www.geeksforgeeks.org/what-is-just-in-time-jit-compiler-in-dot-net/&lt;/a&gt;&#10;&lt;/p&gt;</description></item><item><title>Records</title><link>https://internetexception.com/2022/10/19/records/</link><pubDate>Wed, 19 Oct 2022 16:33:51 +0200</pubDate><guid>https://internetexception.com/2022/10/19/records/</guid><description>&lt;ul&gt;&#10;&lt;li&gt;can be class or struct&lt;/li&gt;&#10;&lt;li&gt;creates methods overrides for enforcing value equality instead of reference equality:&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;Object.Equals&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;Object.GetHashCode&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;operators&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;==&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;!=&lt;/code&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;implements &lt;code&gt;IEquatable&amp;lt;&amp;gt;&lt;/code&gt; parameter&lt;/li&gt;&#10;&lt;li&gt;implements &lt;code&gt;ToString&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;supports deconstruction&lt;/li&gt;&#10;&lt;li&gt;supports &lt;code&gt;with&lt;/code&gt; expression&lt;/li&gt;&#10;&lt;li&gt;meant to be &lt;strong&gt;immutable&lt;/strong&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;&lt;code&gt;Positional records&lt;/code&gt; is a more concise syntax for record:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;primary constructor parameters match the positional parameters of the record declaration&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;public&lt;/strong&gt; &lt;strong&gt;init-only&lt;/strong&gt; properties for each parameter&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/tutorials/records#characteristics-of-records" target="_blank" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/tutorials/records#characteristics-of-records&lt;/a&gt;&#10;&lt;/p&gt;</description></item><item><title>Is it possible to block GC?</title><link>https://internetexception.com/2022/10/19/is-it-possible-to-block-gc/</link><pubDate>Wed, 19 Oct 2022 16:28:54 +0200</pubDate><guid>https://internetexception.com/2022/10/19/is-it-possible-to-block-gc/</guid><description>&lt;p&gt;We can.&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;for some critical part of application code using &lt;code&gt;GC.TryStartNoGCRegion&lt;/code&gt; method.&lt;/li&gt;&#10;&lt;li&gt;using &lt;code&gt;CER&lt;/code&gt; (Constrained Execution Regions) (obsolete)&lt;/li&gt;&#10;&lt;li&gt;with &lt;code&gt;GC LatencyModes&lt;/code&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/api/system.gc.trystartnogcregion?redirectedfrom=MSDN&amp;amp;view=net-7.0#overloads" target="_blank" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/dotnet/api/system.gc.trystartnogcregion?redirectedfrom=MSDN&amp;view=net-7.0#overloads&lt;/a&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/framework/performance/constrained-execution-regions?redirectedfrom=MSDN" target="_blank" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/dotnet/framework/performance/constrained-execution-regions?redirectedfrom=MSDN&lt;/a&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/latency" target="_blank" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/latency&lt;/a&gt;&#10;&lt;/p&gt;</description></item><item><title>Garbage Collector</title><link>https://internetexception.com/2022/10/19/garbage-collector/</link><pubDate>Wed, 19 Oct 2022 16:26:09 +0200</pubDate><guid>https://internetexception.com/2022/10/19/garbage-collector/</guid><description>&lt;ul&gt;&#10;&lt;li&gt;automatic memory management&lt;/li&gt;&#10;&lt;li&gt;allocates and releases memory&lt;/li&gt;&#10;&lt;li&gt;prevents memory leaks and accessing dead objects&lt;/li&gt;&#10;&lt;li&gt;provides memory safety&lt;/li&gt;&#10;&lt;li&gt;virtual memory space&lt;/li&gt;&#10;&lt;li&gt;defragments/compacts memory&lt;/li&gt;&#10;&lt;li&gt;heap have 3 generations&#10;&lt;ul&gt;&#10;&lt;li&gt;0 - for new objects;&lt;/li&gt;&#10;&lt;li&gt;1 - for objects that lives through GC from 0&lt;/li&gt;&#10;&lt;li&gt;2 - for long living objects from 1 and 0&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;also Large Objects Heap (LOH) for big objects like arrays over 85,000 bytes&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/fundamentals?source=recommendations" target="_blank" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/fundamentals?source=recommendations&lt;/a&gt;&#10;&lt;/p&gt;</description></item><item><title>Covariance and Contravariance</title><link>https://internetexception.com/2022/10/19/covariance-and-contravariance/</link><pubDate>Wed, 19 Oct 2022 16:21:04 +0200</pubDate><guid>https://internetexception.com/2022/10/19/covariance-and-contravariance/</guid><description>&lt;ul&gt;&#10;&lt;li&gt;enables implicit reference conversions for&#10;&lt;ul&gt;&#10;&lt;li&gt;arrays&lt;/li&gt;&#10;&lt;li&gt;delegates&lt;/li&gt;&#10;&lt;li&gt;generic type arguments&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Covariance&lt;/strong&gt; preserves assignment compatibility&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Contravariance&lt;/strong&gt; reverses assignment compatibility&lt;/li&gt;&#10;&lt;li&gt;allows for matching signatures of delegates and method groups&#10;&lt;ul&gt;&#10;&lt;li&gt;to assign to delegates from method that returns more derived types - &lt;strong&gt;covariance&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;to assign to delegates from method that returns less derived types - &lt;strong&gt;contravariance&lt;/strong&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Covariance&lt;/strong&gt; and &lt;strong&gt;Contravariance&lt;/strong&gt; are supported in &lt;strong&gt;Generics&lt;/strong&gt; for implicit conversions for type parameters&#10;&lt;ul&gt;&#10;&lt;li&gt;allows method to have more derived return type than defined by generic type parameter of the interface&lt;/li&gt;&#10;&lt;li&gt;this allows implicit conversions from one generic interface to another (from &lt;code&gt;IEnumerable&amp;lt;string&amp;gt;&lt;/code&gt; to &lt;code&gt;IEnumerable&amp;lt;object&amp;gt;&lt;/code&gt; even if first does not inherits from second)&lt;/li&gt;&#10;&lt;li&gt;allows generic types to have less derived argument types than specified by the generic parameter of the interface (implementation of &lt;code&gt;IEqualityComparer&amp;lt;BaseClass&amp;gt;&lt;/code&gt; can be implicitly converted to &lt;code&gt;IEqualityComparer&amp;lt;DerivedClass&amp;gt;&lt;/code&gt; because &lt;code&gt;IEqualityComparer.Equals&lt;/code&gt; is contravariant)&lt;/li&gt;&#10;&lt;li&gt;implicit conversions works for interfaces but not classes that implement from those interfaces (i.e. this won&amp;rsquo;t work &lt;code&gt;List&amp;lt;Object&amp;gt; list = new List&amp;lt;String&amp;gt;()&lt;/code&gt;)&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;&lt;em&gt;Assignment compatibility&lt;/em&gt; is when object of a more derived type is assigned to an object of a less derived type.&lt;/p&gt;</description></item><item><title>.NET Generics</title><link>https://internetexception.com/2022/10/19/net-generics/</link><pubDate>Wed, 19 Oct 2022 15:48:04 +0200</pubDate><guid>https://internetexception.com/2022/10/19/net-generics/</guid><description>&lt;p&gt;Allow for:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;generalization of logic based on available types&lt;/li&gt;&#10;&lt;li&gt;specify possible supported types&lt;/li&gt;&#10;&lt;li&gt;re-usability of code&lt;/li&gt;&#10;&lt;li&gt;type safety&lt;/li&gt;&#10;&lt;li&gt;defers the exact specification of logic until the class or method is declared and instantiated by user code with all type parameters specified&lt;/li&gt;&#10;&lt;li&gt;mostly used for collections (some non-generic versions of collection are not recommended like &lt;code&gt;ArrayList&lt;/code&gt; i.e.)&lt;/li&gt;&#10;&lt;li&gt;information of exact type parameters used in a generic can be obtained at runtime by reflection&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;</description></item><item><title>Data structures in .NET</title><link>https://internetexception.com/2022/10/19/data-structures-in-net/</link><pubDate>Wed, 19 Oct 2022 14:52:50 +0200</pubDate><guid>https://internetexception.com/2022/10/19/data-structures-in-net/</guid><description>&lt;p&gt;In table below official recommendations for choosing data structure for your needs:&lt;/p&gt;&#10;&lt;table&gt;&#10;&lt;tbody&gt;&#10;&lt;tr&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;Generic&lt;/td&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;Non-Generic&lt;/td&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;Thread safe&lt;/td&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;Purpose&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;&lt;code&gt;Dictionary&lt;/code&gt;&lt;/td&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;&lt;code&gt;Hashtable&lt;/code&gt;&lt;/td&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;&lt;code&gt;ConcurrentDictionary&lt;/code&gt;&lt;/td&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;key value pairs, lookup&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;&lt;code&gt;List&lt;/code&gt;&lt;/td&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;&lt;code&gt;Array&lt;/code&gt;&lt;/td&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;&lt;code&gt;ImmutableList&lt;/code&gt;&lt;/td&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;access items by index&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;&lt;code&gt;Queue&lt;/code&gt;&lt;/td&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;-&lt;/td&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;&lt;code&gt;ConcurrentQueue&lt;/code&gt;&lt;/td&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;FIFO queue&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;&lt;code&gt;Stack&lt;/code&gt;&lt;/td&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;-&lt;/td&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;&lt;code&gt;ConcurrentStack&lt;/code&gt;&lt;/td&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;LIFO queue&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;&lt;code&gt;LinkedList&lt;/code&gt;&lt;/td&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;-&lt;/td&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;-&lt;/td&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;access items sequentially&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;&lt;code&gt;ObservableCollection&lt;/code&gt;&lt;/td&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;-&lt;/td&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;-&lt;/td&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;notfications after modification&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;&lt;code&gt;SortedList&lt;/code&gt;&lt;/td&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;&lt;/td&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;&lt;code&gt;ImmutableSortedSet&lt;/code&gt;&lt;/td&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;auto sorted collection&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;&lt;code&gt;HashSet&lt;/code&gt;&lt;/td&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;&lt;/td&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;&lt;code&gt;ImmutableHashSet&lt;/code&gt;&lt;/td&gt;&#10;&lt;td class="has-text-align-center" data-align="center"&gt;dictionary of just keys (high performance set operations)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;</description></item><item><title>Strings in .NET</title><link>https://internetexception.com/2022/10/19/strings-in-net/</link><pubDate>Wed, 19 Oct 2022 14:44:37 +0200</pubDate><guid>https://internetexception.com/2022/10/19/strings-in-net/</guid><description>&lt;ul&gt;&#10;&lt;li&gt;sequential collection of chars&lt;/li&gt;&#10;&lt;li&gt;immutable&lt;/li&gt;&#10;&lt;li&gt;max 2GB or about 1 billion characters&lt;/li&gt;&#10;&lt;li&gt;reference type&lt;/li&gt;&#10;&lt;li&gt;are interned - CLR saves memory by maintaining a table, called the &amp;ldquo;intern pool&amp;rdquo;, that contains a single reference to each unique literal string declared or created programmatically in your program.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-7.0" target="_blank" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-7.0&lt;/a&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/api/system.string.intern?view=net-6.0#remarks" target="_blank" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/dotnet/api/system.string.intern?view=net-6.0#remarks&lt;/a&gt;&#10;&lt;/p&gt;</description></item><item><title>What type can not be object field?</title><link>https://internetexception.com/2022/10/19/what-type-can-not-be-object-field/</link><pubDate>Wed, 19 Oct 2022 14:33:00 +0200</pubDate><guid>https://internetexception.com/2022/10/19/what-type-can-not-be-object-field/</guid><description>&lt;p&gt;&lt;code&gt;ref struct&lt;/code&gt; type can not be used as object field.&lt;/p&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="http://2022/10/19/ref-struct-types/" target="_blank" rel="noopener noreferrer"&gt;`ref struct` types&lt;/a&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/ref-struct" target="_blank" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/ref-struct&lt;/a&gt;&#10;&lt;/p&gt;</description></item><item><title>`ref struct` types</title><link>https://internetexception.com/2022/10/19/ref-struct-types/</link><pubDate>Wed, 19 Oct 2022 14:28:48 +0200</pubDate><guid>https://internetexception.com/2022/10/19/ref-struct-types/</guid><description>&lt;ul&gt;&#10;&lt;li&gt;added as part of C# 7.2.&lt;/li&gt;&#10;&lt;li&gt;defined with &lt;code&gt;ref struct StructName&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;always on the stack&lt;/li&gt;&#10;&lt;li&gt;never part of heap&lt;/li&gt;&#10;&lt;li&gt;cannot be element of an array&lt;/li&gt;&#10;&lt;li&gt;cannot be field type of reference type&lt;/li&gt;&#10;&lt;li&gt;can&amp;rsquo;t implement interfaces&lt;/li&gt;&#10;&lt;li&gt;can&amp;rsquo;t be boxed&lt;/li&gt;&#10;&lt;li&gt;can&amp;rsquo;t be type argument&lt;/li&gt;&#10;&lt;li&gt;can&amp;rsquo;t be captured by closure of lambda or local function&lt;/li&gt;&#10;&lt;li&gt;can&amp;rsquo;t be used in async methods&lt;/li&gt;&#10;&lt;li&gt;can&amp;rsquo;t be used in iterators&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/ref-struct" target="_blank" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/ref-struct&lt;/a&gt;&#10;&lt;/p&gt;</description></item><item><title>Value types as fields in objects</title><link>https://internetexception.com/2022/10/19/value-types-as-fields-in-objects/</link><pubDate>Wed, 19 Oct 2022 14:26:29 +0200</pubDate><guid>https://internetexception.com/2022/10/19/value-types-as-fields-in-objects/</guid><description>&lt;p&gt;Value types are stored in the &lt;strong&gt;heap&lt;/strong&gt; when they are part of the reference type.&lt;/p&gt;</description></item><item><title>Reference types vs Value types</title><link>https://internetexception.com/2022/10/19/reference-types-vs-value-types/</link><pubDate>Wed, 19 Oct 2022 14:17:17 +0200</pubDate><guid>https://internetexception.com/2022/10/19/reference-types-vs-value-types/</guid><description>&lt;p&gt;&lt;strong&gt;Reference types:&lt;/strong&gt;&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;passed via reference&lt;/li&gt;&#10;&lt;li&gt;reside on the heap&lt;/li&gt;&#10;&lt;li&gt;subject to GC&lt;/li&gt;&#10;&lt;li&gt;inherits from &lt;code&gt;System.Object&lt;/code&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;&lt;strong&gt;Value types:&lt;/strong&gt;&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;passed via value&lt;/li&gt;&#10;&lt;li&gt;reside on the stack, CPU registers or the heap&lt;/li&gt;&#10;&lt;li&gt;no subject to GC&lt;/li&gt;&#10;&lt;li&gt;inherits from &lt;code&gt;System.ValueType&lt;/code&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/reference-types" target="_blank" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/reference-types&lt;/a&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/value-types" target="_blank" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/value-types&lt;/a&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://www.infoworld.com/article/3043992/a-deep-dive-value-and-reference-types-in-net.html" target="_blank" rel="noopener noreferrer"&gt;https://www.infoworld.com/article/3043992/a-deep-dive-value-and-reference-types-in-net.html&lt;/a&gt;&#10;&lt;/p&gt;</description></item><item><title>.NET Type System</title><link>https://internetexception.com/2022/10/19/net-type-system/</link><pubDate>Wed, 19 Oct 2022 13:59:44 +0200</pubDate><guid>https://internetexception.com/2022/10/19/net-type-system/</guid><description>&lt;ul&gt;&#10;&lt;li&gt;shared type system across all .net languages&lt;/li&gt;&#10;&lt;li&gt;primitives data types library&lt;/li&gt;&#10;&lt;li&gt;5 kind of types:&#10;&lt;ul&gt;&#10;&lt;li&gt;classes&lt;/li&gt;&#10;&lt;li&gt;structures&lt;/li&gt;&#10;&lt;li&gt;enumerations&lt;/li&gt;&#10;&lt;li&gt;interfaces&lt;/li&gt;&#10;&lt;li&gt;delegates&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/standard/base-types/common-type-system" target="_blank" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/dotnet/standard/base-types/common-type-system&lt;/a&gt;&#10;&lt;/p&gt;</description></item><item><title>ThreadPool</title><link>https://internetexception.com/2022/10/19/threadpool/</link><pubDate>Wed, 19 Oct 2022 13:53:37 +0200</pubDate><guid>https://internetexception.com/2022/10/19/threadpool/</guid><description>&lt;ul&gt;&#10;&lt;li&gt;provides a pool of threads&lt;/li&gt;&#10;&lt;li&gt;can be used to execute tasks&lt;/li&gt;&#10;&lt;li&gt;post work items&lt;/li&gt;&#10;&lt;li&gt;process asynchronous I/O&lt;/li&gt;&#10;&lt;li&gt;process timers&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/api/system.threading.threadpool?view=net-6.0" target="_blank" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/dotnet/api/system.threading.threadpool?view=net-6.0&lt;/a&gt;&#10;&lt;/p&gt;</description></item><item><title>Task Parallel Library (TPL)</title><link>https://internetexception.com/2022/10/19/task-parallel-library-tpl/</link><pubDate>Wed, 19 Oct 2022 13:51:20 +0200</pubDate><guid>https://internetexception.com/2022/10/19/task-parallel-library-tpl/</guid><description>&lt;ul&gt;&#10;&lt;li&gt;simplify process of adding parallelism and concurrency to application&lt;/li&gt;&#10;&lt;li&gt;scales concurrency automatically&lt;/li&gt;&#10;&lt;li&gt;data parallelism&lt;/li&gt;&#10;&lt;li&gt;task based &lt;code&gt;async&lt;/code&gt; programming&lt;/li&gt;&#10;&lt;li&gt;data flow&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/standard/parallel-programming/task-parallel-library-tpl" target="_blank" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/dotnet/standard/parallel-programming/task-parallel-library-tpl&lt;/a&gt;&#10;&lt;/p&gt;</description></item><item><title>Locking with integer</title><link>https://internetexception.com/2022/10/19/locking-with-integer/</link><pubDate>Wed, 19 Oct 2022 13:44:02 +0200</pubDate><guid>https://internetexception.com/2022/10/19/locking-with-integer/</guid><description>&lt;p&gt;In short:&lt;/p&gt;&#10;&lt;p&gt;it will not work because it requires boxing and boxing will create new object for reference in &lt;code&gt;lock&lt;/code&gt; every time code is executed so lock statement will not prevent anything.&lt;/p&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://intellitect.com/blog/locking-a-block-of-code-with-an-integer/" target="_blank" rel="noopener noreferrer"&gt;https://intellitect.com/blog/locking-a-block-of-code-with-an-integer/&lt;/a&gt;&#10;&lt;/p&gt;</description></item><item><title>Locking in .NET</title><link>https://internetexception.com/2022/10/19/locking-in-net/</link><pubDate>Wed, 19 Oct 2022 13:27:01 +0200</pubDate><guid>https://internetexception.com/2022/10/19/locking-in-net/</guid><description>&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;lock&lt;/code&gt; statement blocks execution of a code block for single thread that hold lock&lt;/li&gt;&#10;&lt;li&gt;the same thread can acquire and release lock again&lt;/li&gt;&#10;&lt;li&gt;any other thread is blocked from the statement&lt;/li&gt;&#10;&lt;li&gt;lock on dedicated instance only&lt;/li&gt;&#10;&lt;li&gt;using the same instance on multiple &lt;code&gt;lock&lt;/code&gt; statements may lead to deadlock&lt;/li&gt;&#10;&lt;li&gt;avoid using as lock&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;this&lt;/code&gt;, as it might be used by the callers as a lock&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/api/system.type" target="_blank" rel="noopener noreferrer"&gt;Type&lt;/a&gt;&#10; instances, as those might be obtained by the &lt;a href="https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/type-testing-and-cast#typeof-operator" target="_blank" rel="noopener noreferrer"&gt;typeof&lt;/a&gt;&#10; operator or reflection&lt;/li&gt;&#10;&lt;li&gt;string instances, including string literals, as those might be &lt;a href="https://learn.microsoft.com/en-us/dotnet/api/system.string.intern#remarks" target="_blank" rel="noopener noreferrer"&gt;interned&lt;/a&gt;&#10;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;Hold a lock for as short time as possible to reduce lock contention.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Below code block is translated by compiler&lt;/p&gt;</description></item><item><title>Thread vs task in . NET</title><link>https://internetexception.com/2022/10/19/thread-vs-task-in-net/</link><pubDate>Wed, 19 Oct 2022 13:12:33 +0200</pubDate><guid>https://internetexception.com/2022/10/19/thread-vs-task-in-net/</guid><description>&lt;ul&gt;&#10;&lt;li&gt;task is asynchronous operation&lt;/li&gt;&#10;&lt;li&gt;thread is abstraction on OS thread&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://www.c-sharpcorner.com/article/task-and-thread-in-c-sharp/" target="_blank" rel="noopener noreferrer"&gt;https://www.c-sharpcorner.com/article/task-and-thread-in-c-sharp/&lt;/a&gt;&#10;&lt;/p&gt;</description></item><item><title>What is SynchronizationContext in .NET</title><link>https://internetexception.com/2022/10/19/what-is-synchronizationcontext-in-net/</link><pubDate>Wed, 19 Oct 2022 13:08:18 +0200</pubDate><guid>https://internetexception.com/2022/10/19/what-is-synchronizationcontext-in-net/</guid><description>&lt;ul&gt;&#10;&lt;li&gt;multi threaded programs usually uses one of the threads as means of synchronization&lt;/li&gt;&#10;&lt;li&gt;there are message loops to pass unit of works (like Windows message queue)&lt;/li&gt;&#10;&lt;li&gt;message queues require messages formats and convention for handling it&lt;/li&gt;&#10;&lt;li&gt;single thread to handle ASP.NET request is waste of the resources (before .NET 2)&lt;/li&gt;&#10;&lt;li&gt;thread pool was better but inconvenient to work with&lt;/li&gt;&#10;&lt;li&gt;instead &lt;strong&gt;SynchronizationContext&lt;/strong&gt; queues work for given &lt;em&gt;context&lt;/em&gt; not thread&lt;/li&gt;&#10;&lt;li&gt;thread have &lt;em&gt;current&lt;/em&gt; context&lt;/li&gt;&#10;&lt;li&gt;context does not have to be &lt;em&gt;unique&lt;/em&gt; but can be shared between &lt;em&gt;multiple threads&lt;/em&gt;&lt;/li&gt;&#10;&lt;li&gt;thread can &lt;em&gt;change context&lt;/em&gt; but this is &lt;em&gt;rare&lt;/em&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;SynchronizationContext&lt;/strong&gt; keeps count of all asynchronous operations&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Windows Forms&lt;/strong&gt; uses &lt;strong&gt;WindowsFormsSynchronizationContext&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;WPF and Silverlight&lt;/strong&gt; uses &lt;strong&gt;DispatcherSynchronizationContext&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Console app and WindowsServices and ThreadPool threads&lt;/strong&gt; uses &lt;strong&gt;default SynchronizationContext&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;ASP.NET&lt;/strong&gt; uses &lt;strong&gt;AspNetSynchronizationContext&lt;/strong&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;</description></item><item><title>Does async/await creates new thread?</title><link>https://internetexception.com/2022/10/19/does-async-await-creates-new-thread/</link><pubDate>Wed, 19 Oct 2022 12:58:00 +0200</pubDate><guid>https://internetexception.com/2022/10/19/does-async-await-creates-new-thread/</guid><description>&lt;p&gt;In short: &lt;strong&gt;no&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;p&gt;Longer explanation:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;task that want to do I/O write call to driver write&lt;/li&gt;&#10;&lt;li&gt;driver operations are performed asynchronously&lt;/li&gt;&#10;&lt;li&gt;write operations on devices is done without CPU involved&lt;/li&gt;&#10;&lt;li&gt;finish of writing is done via interrupt&lt;/li&gt;&#10;&lt;li&gt;interrupt, schedules &lt;code&gt;Deferred Procedure Call&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;DPC&lt;/code&gt; schedules &lt;code&gt;Asynchronous Procedure Call&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;APC&lt;/code&gt; notifies thread that I/O write is done&lt;/li&gt;&#10;&lt;li&gt;task that was doing I/O is scheduled with continuation of its method after I/O is done.&lt;/li&gt;&#10;&lt;li&gt;some threads might need to be borrowed for handling APC and such but &lt;em&gt;no thread is spawn to handle I/O&lt;/em&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;I recommend reading this post: &lt;a href="https://blog.stephencleary.com/2013/11/there-is-no-thread.html" data-type="URL" data-id="https://blog.stephencleary.com/2013/11/there-is-no-thread.html"&gt;&lt;a href="https://blog.stephencleary.com/2013/11/there-is-no-thread.html" target="_blank" rel="noopener noreferrer"&gt;https://blog.stephencleary.com/2013/11/there-is-no-thread.html&lt;/a&gt;&#10;&lt;/a&gt;. This will explain the topic much better than I can.&lt;/p&gt;</description></item><item><title>Avoid deadlock with asynchronous methods</title><link>https://internetexception.com/2022/10/19/avoid-deadlock-with-asynchronous-methods/</link><pubDate>Wed, 19 Oct 2022 12:52:45 +0200</pubDate><guid>https://internetexception.com/2022/10/19/avoid-deadlock-with-asynchronous-methods/</guid><description>&lt;ul&gt;&#10;&lt;li&gt;avoid doing &lt;code&gt;AsyncOperation.Result&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;parent method waits for &lt;code&gt;Result&lt;/code&gt; while child method waits for parent thread to take control, after being done with async I/O&lt;/li&gt;&#10;&lt;li&gt;both waits&lt;/li&gt;&#10;&lt;li&gt;deadlock&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://medium.com/rubrikkgroup/understanding-async-avoiding-deadlocks-e41f8f2c6f5d" target="_blank" rel="noopener noreferrer"&gt;https://medium.com/rubrikkgroup/understanding-async-avoiding-deadlocks-e41f8f2c6f5d&lt;/a&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://stackoverflow.com/questions/15021304/an-async-await-example-that-causes-a-deadlock" target="_blank" rel="noopener noreferrer"&gt;https://stackoverflow.com/questions/15021304/an-async-await-example-that-causes-a-deadlock&lt;/a&gt;&#10;&lt;/p&gt;</description></item><item><title>Asynchronous programming in .NET</title><link>https://internetexception.com/2022/10/19/asynchronous-programming-in-net/</link><pubDate>Wed, 19 Oct 2022 09:52:30 +0200</pubDate><guid>https://internetexception.com/2022/10/19/asynchronous-programming-in-net/</guid><description>&lt;p&gt;Asynchronous programming patterns in .NET:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/standard/asynchronous-programming-patterns/asynchronous-programming-model-apm" data-type="URL" data-id="https://learn.microsoft.com/en-us/dotnet/standard/asynchronous-programming-patterns/asynchronous-programming-model-apm"&gt;Asynchronous Programming Model&lt;/a&gt; (BeginOperation/EndOperation)&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/standard/asynchronous-programming-patterns/event-based-asynchronous-pattern-overview" data-type="URL" data-id="https://learn.microsoft.com/en-us/dotnet/standard/asynchronous-programming-patterns/event-based-asynchronous-pattern-overview"&gt;Event-based Asynchronous Pattern&lt;/a&gt; (invoke event with result from async job)&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/async/task-asynchronous-programming-model" target="_blank" rel="noopener noreferrer"&gt;Task-based Asynchronous Pattern&lt;/a&gt;&#10; (Task&amp;lt;&amp;gt;)&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Ways of achieving asynchronous code in .NET&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;async, await&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;Task&lt;/code&gt; class API (&lt;code&gt;Run&lt;/code&gt;, &lt;code&gt;WhenAll&lt;/code&gt;, &lt;code&gt;WhenAny&lt;/code&gt;, etc.)&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;ThreadPool.QueueUserWorkItem(ThreadProc);&lt;/code&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://internetexception.com/2022/10/19/async-await-in-c/" data-type="URL" data-id="/2022/10/19/async-await-in-c/"&gt;async/await in .NET&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/dotnet/standard/asynchronous-programming-patterns/" target="_blank" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/dotnet/standard/asynchronous-programming-patterns/&lt;/a&gt;&#10;&lt;/p&gt;</description></item><item><title>async/await in C#</title><link>https://internetexception.com/2022/10/19/async-await-in-c/</link><pubDate>Wed, 19 Oct 2022 09:51:34 +0200</pubDate><guid>https://internetexception.com/2022/10/19/async-await-in-c/</guid><description>&lt;p&gt;&lt;code&gt;async&lt;/code&gt;/&lt;code&gt;await&lt;/code&gt; syntax should be used for &lt;a href="https://internetexception.com/2022/10/19/async-await-in-c/" data-type="post" data-id="491"&gt;I/O bound&lt;/a&gt; asynchronous operations only.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-csharp" data-lang="csharp"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;async&lt;/span&gt; &lt;span class="n"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;GetUrlContentLengthAsync&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;HttpClient&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;getStringTask&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GetStringAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;https://docs.microsoft.com/dotnet&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;DoIndependentWork&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;contents&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;getStringTask&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;contents&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Compiler transforms code into a state machine that to track yielding execution for &lt;code&gt;await&lt;/code&gt; and resuming execution when a background job is finished.&lt;/p&gt;&#10;&lt;p&gt;Things to keep in mind:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;async&lt;/code&gt; method needs await&lt;/li&gt;&#10;&lt;li&gt;add &lt;code&gt;Async&lt;/code&gt; suffix to asynchronous methods&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;async void&lt;/code&gt; for &amp;lsquo;Fire and Forget&amp;rsquo; work i.e. event Handlers&lt;/li&gt;&#10;&lt;li&gt;be aware of mixing LINQ with &lt;code&gt;async&lt;/code&gt; lambdas&lt;/li&gt;&#10;&lt;li&gt;wait for tasks in a non-blocking manner (do not use &lt;code&gt;Task.Result&lt;/code&gt; i.e.)&lt;/li&gt;&#10;&lt;li&gt;for tight loops use &lt;code&gt;ValueTasks&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;Consider using &lt;code&gt;ConfigureAwait(false)&lt;/code&gt; for performance and for avoiding deadlocks&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;</description></item><item><title>CPU bound vs I/O bound</title><link>https://internetexception.com/2022/10/19/cpu-bound-vs-i-o-bound/</link><pubDate>Wed, 19 Oct 2022 09:35:37 +0200</pubDate><guid>https://internetexception.com/2022/10/19/cpu-bound-vs-i-o-bound/</guid><description>&lt;p&gt;There are two types of asynchronous operations in .NET.&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;I/O bound&lt;/li&gt;&#10;&lt;li&gt;CPU bound&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;For I/O bound &lt;code&gt;async&lt;/code&gt;/&lt;code&gt;await&lt;/code&gt; syntax should be used. TPL should not be used for this. &lt;code&gt;async&lt;/code&gt; methods does not spawns new thread to hand le I/O work asynchronously.&lt;/p&gt;&#10;&lt;p&gt;For CPU bound operations TPL should be used (&lt;code&gt;Task.Run&lt;/code&gt;). This spawns new thread. Performance testing should be done to check if overhead of new thread and context switching is not greater than actual work to be done.&lt;/p&gt;</description></item><item><title>SupressFinalize in IDisposable interface</title><link>https://internetexception.com/2022/10/18/supressfinalize-in-idisposable-interface/</link><pubDate>Tue, 18 Oct 2022 14:24:06 +0200</pubDate><guid>https://internetexception.com/2022/10/18/supressfinalize-in-idisposable-interface/</guid><description>&lt;ul&gt;&#10;&lt;li&gt;informs GC that object does not need to be added to finalizer queue&lt;/li&gt;&#10;&lt;li&gt;finalizer execution is not deterministic and objects can live for long time in queue - this is optimization technique&lt;/li&gt;&#10;&lt;li&gt;to make sure that object disposes of any unamanaged resources even if &lt;code&gt;Dispose&lt;/code&gt; will be not called we need to implement finalizer&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Basically finalizer execution time is not deterministic. We cannot predict when this will be called and till that time - object is existing and still taking memory space. Since we are controlling creation and disposal of those resources we can say to GC: &amp;lsquo;Do not worry about that! It already had been taken care of!&amp;rsquo;. So this way object will be destroyed sooner, leaving this space to be used by something else possibly.&lt;/p&gt;</description></item><item><title>IDisposable interface pattern</title><link>https://internetexception.com/2022/10/18/idisposable-interface-pattern/</link><pubDate>Tue, 18 Oct 2022 14:16:21 +0200</pubDate><guid>https://internetexception.com/2022/10/18/idisposable-interface-pattern/</guid><description>&lt;p&gt;Example implementation of &lt;code&gt;IDisposable&lt;/code&gt;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-csharp" data-lang="csharp"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MyResource&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;IDisposable&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="n"&gt;MyResource&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;IntPtr&lt;/span&gt; &lt;span class="n"&gt;handle&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;handle&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;handle&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="n"&gt;Dispose&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;Dispose&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;disposing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;GC&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SuppressFinalize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kd"&gt;protected&lt;/span&gt; &lt;span class="k"&gt;virtual&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="n"&gt;Dispose&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="n"&gt;disposing&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(!&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;disposed&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;disposing&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;component&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Dispose&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;CloseHandle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;handle&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;handle&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;IntPtr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Zero&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;disposed&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;~&lt;/span&gt;&lt;span class="n"&gt;MyResource&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;Dispose&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;disposing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;MyResource&lt;/code&gt; object have pointer which is unmanaged. This is why this class should implement &lt;code&gt;IDisposable&lt;/code&gt; interface. Implementation should be correct according to recommended pattern (see below for documentation).&lt;/p&gt;&#10;&lt;p&gt;There a re few points to highlight here:&lt;/p&gt;</description></item><item><title>General Interview Questions</title><link>https://internetexception.com/2022/10/18/general-interview-questions/</link><pubDate>Tue, 18 Oct 2022 13:32:58 +0200</pubDate><guid>https://internetexception.com/2022/10/18/general-interview-questions/</guid><description>&lt;ul&gt;&#10;&lt;li&gt;Closed&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;a href="https://internetexception.com/2022/10/17/what-is-asynchronous-programming/" data-type="URL" data-id="/2022/10/17/what-is-asynchronous-programming/"&gt;What is asynchronous programming?&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://internetexception.com/2022/10/18/what-is-tdd/" data-type="URL" data-id="/2022/10/18/what-is-tdd/"&gt;What is TDD&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://internetexception.com/2022/10/18/what-is-bdd/" data-type="URL" data-id="/2022/10/18/what-is-bdd/"&gt;What is BDD&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://internetexception.com/2022/10/18/what-is-ddd/" data-type="URL" data-id="/2022/10/18/what-is-ddd/"&gt;What is DDD&lt;/a&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;Open - to consider for yourself&#10;&lt;ul&gt;&#10;&lt;li&gt;Interesting technical problem you solved lately&lt;/li&gt;&#10;&lt;li&gt;Interesting technical problem you solved during your career&lt;/li&gt;&#10;&lt;li&gt;What is the process of the MR/PR change review for you&lt;/li&gt;&#10;&lt;li&gt;What is great success you accomplished lately? What skill did you improved lately?&lt;/li&gt;&#10;&lt;li&gt;What is your greatest failure during your career? What was your biggest mistake?&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;/ul&gt;</description></item><item><title>What is DDD</title><link>https://internetexception.com/2022/10/18/what-is-ddd/</link><pubDate>Tue, 18 Oct 2022 13:29:02 +0200</pubDate><guid>https://internetexception.com/2022/10/18/what-is-ddd/</guid><description>&lt;ul&gt;&#10;&lt;li&gt;software design approach&lt;/li&gt;&#10;&lt;li&gt;software should be driven by business domain&lt;/li&gt;&#10;&lt;li&gt;pieces of software should match the business domain&lt;/li&gt;&#10;&lt;li&gt;goals:&#10;&lt;ul&gt;&#10;&lt;li&gt;domain is primary focus&lt;/li&gt;&#10;&lt;li&gt;complex design should base on model of the domain&lt;/li&gt;&#10;&lt;li&gt;devs and business should continuously work on refining this model to address changes in business&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;common language for defining a business model of the domain&lt;/li&gt;&#10;&lt;li&gt;complex logic should be abstracted to domain&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Domain-driven_design" target="_blank" rel="noopener noreferrer"&gt;https://en.wikipedia.org/wiki/Domain-driven_design&lt;/a&gt;&#10;&lt;/p&gt;</description></item><item><title>What is BDD</title><link>https://internetexception.com/2022/10/18/what-is-bdd/</link><pubDate>Tue, 18 Oct 2022 13:24:32 +0200</pubDate><guid>https://internetexception.com/2022/10/18/what-is-bdd/</guid><description>&lt;ul&gt;&#10;&lt;li&gt;based on TDD&lt;/li&gt;&#10;&lt;li&gt;better collaboration between devs, QAs and business than TDD&lt;/li&gt;&#10;&lt;li&gt;behavioral tests first, implementation second&lt;/li&gt;&#10;&lt;li&gt;behavioral tests should be easy to understand, simple&lt;/li&gt;&#10;&lt;li&gt;those tests should be written in specific language, possible to understood by business&lt;/li&gt;&#10;&lt;li&gt;combines idea of unit tests naming, acceptance tests standard agile framework (As a XXX I want YY to achieve ZZ), and acceptance criteria with Gherkin&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Behavior-driven_development" target="_blank" rel="noopener noreferrer"&gt;https://en.wikipedia.org/wiki/Behavior-driven_development&lt;/a&gt;&#10;&lt;/p&gt;</description></item><item><title>What is TDD</title><link>https://internetexception.com/2022/10/18/what-is-tdd/</link><pubDate>Tue, 18 Oct 2022 13:08:00 +0200</pubDate><guid>https://internetexception.com/2022/10/18/what-is-tdd/</guid><description>&lt;p&gt;Test-driven development&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;software requirements are converted to tests cases *before* actual implementation&lt;/li&gt;&#10;&lt;li&gt;implementation is done against all those test cases&lt;/li&gt;&#10;&lt;li&gt;opposing to first writing an implementation then tests cases&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Further read:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Test-driven_development" target="_blank" rel="noopener noreferrer"&gt;https://en.wikipedia.org/wiki/Test-driven_development&lt;/a&gt;&#10;&lt;/p&gt;</description></item><item><title>What is asynchronous programming?</title><link>https://internetexception.com/2022/10/17/what-is-asynchronous-programming/</link><pubDate>Mon, 17 Oct 2022 16:25:05 +0200</pubDate><guid>https://internetexception.com/2022/10/17/what-is-asynchronous-programming/</guid><description>&lt;ul&gt;&#10;&lt;li&gt;software often waits for some I/O operation to complete (file operation, network call, database query etc.)&lt;/li&gt;&#10;&lt;li&gt;we can use this time for something productive instead to wait for data to be available or I/O operation to be completed&lt;/li&gt;&#10;&lt;li&gt;with asynchronous programming user can work in the meantime&lt;/li&gt;&#10;&lt;li&gt;not waiting for I/O operations synchronously enhances user experience&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Of course this problem is much more complex. Modern software operates on much more different PC architecture than 20 years ago. Nowadays software must be asynchronous to appear more user friendly and to made better use of modern multi CPU architecture. Right now complex, professional software uses multiple processes, threads on multiple CPUs (CPU you buy is not really *single* CPU) or even utilize GPU for more complex computations (like i.e. video editing software). Before that we mostly had single threaded desktop applications that had &amp;lsquo;please wait&amp;rsquo; or &amp;rsquo;loading&amp;rsquo; pop ups. Right now this is song of the past really and to achieve better User Interfaces that allow to edit tag of your post without changing whole post. With mobile devices on the rise and sometimes lousy cellular network those kind of designs would not be sensible or sometimes impossible to implement. Did you ever happened to reenter some chunk of data into some software because you lost it? Maybe network was down? Or you hit back button by mistake? Right now it belongs to past mostly. All of those would be hard to do with synchronous operations. Right now people are bit spoiled and they tend to leave the page/application if it appears to be slow and not every company can sell &amp;lsquo;one-in-the-market-necessary-for-your-work-software&amp;rsquo; that you will be forced to use. And this is why we have asynchronous operations and this is why we have asynchronous programming model that allows us to program such operations.&lt;/p&gt;</description></item></channel></rss>