Проекты
RSS
разработка сайтов
оптимизация сайта
веб-дизайн
продвижение сайтов
SEO
HTML5
CSS3
ASP.NET
ASP.NET MVC
.NET Core
jQuery
Bootstrap
Angular
React
 
Тэг: csharp
Always will be ready notify the world about expectations as easy as possible: job change page

The following are a set of best practices for using the HttpClient object in .NET Core when communicating with web APIs. Note that probably not all practices would be recommended in all situations. There can always be good reasons to break from a certain practice. This list is not supposed to be exhaustive and will probably be edited over time. All code examples are in C#. Manage HttpClient instances with HttpClientFactory HttpClient implements IDisposable....

далее...

.NET has a large number of built in exceptions. However, there maybe times when none of the built exceptions seem adequate for your particular scenario and you will need to create your own custom (AKA “user defined”) exception. This post focuses on a discussion of how to create custom exceptions in .NET. The different types of built in .NET exceptions, exception handling, throwing, and more general exception related best practices will...

далее...

Code Generation Code generation is a great way to apply patterns consistently across a solution or to create multiple similar classes based on some outside input file, or even other classes in the same solution. The tooling has changed over the years, but the result is the same… a lot of code that I don’t have to write by hand, or update when patterns change and evolve. I’ve been generating source code...

далее...

If you’re anything like me, you’ve looked for ways of making your applications faster. In this article, I’ll show you a somewhat unknown class in the .NET framework that makes lazy creation of objects easy to do and thread safe. The Old Way Before we get to the fun stuff, let’s take a look at how you might try to do these things without .NET’s Lazy<T> classes. Typically when you design a class,...

далее...

In C#, reference types can be assigned null values. This is something that developers will have to live with until they use classes to create software. Unfortunately, the folks at Microsoft cannot simply disallow null assignment to reference variables at compile time, because that would break the codebase of almost every project. Returning Null is bad practice What is actually wrong with returning a null reference from the method? Let’s take a look...

далее...

In the context of helping the teams at Criteo to clean up our code base, I gathered and documented a few C# anti-patterns similar to Kevin’s publication about performance code smell. Here is an extract related to good/bad memory patterns. Even though the garbage collector is doing its works out of the control of the developers, the less allocations are done, the less the GC will impact an application. So the...

далее...

C# has a feature, String Interpolation, to format strings in a flexible and readable way. The following example demonstrates the way how we usually output a string when we have data beforehand then pass data to the template string. var name = "April"; var dob = new DateTime(2000, 4, 10); Console.WriteLine($"Her name is {name} and her birthday is on {dob:MM/dd/yyyy}, which is in {dob:MMMM}."); // Console Output: // Her name is April and sher birthday...

далее...

© 1999–2021 WebDynamics
1980–... Sergey Drozdov
Area of interests: .NET | .NET Coe | C# | ASP.NET | Windows Forms | Windows Phone | HTML5 | CSS3 | jQuery | AJAX | MS SQL Server | Transact-SQL | ADO.NET | Entity Framework | IIS | OOP | OOA | OOD | WCF | WPF | MSMQ | MVC | MVP | MVVM | Design Patterns | Enterprise Architecture | Scrum | Kanban