How To

How to Use the New Lock Object in C#
By Tan Lee Published on Jan 15, 2025 554

C# has supported thread synchronization with the `lock` keyword since its early versions, ensuring that only one thread executes a block of code at a time.

Mask email address for GDPR reasons
By Tan Lee Published on Jan 14, 2025 548

With the introduction of the General Data Protection Regulation (GDPR), companies must be extra cautious about handling personal data, including email addresses.

Add Thread ID to the Log File using Serilog
By Tan Lee Published on Jan 14, 2025 631

To add the Thread ID to the log file using Serilog in an ASP.NET Core application, you can follow these steps:

How to Deserialize XML array to string[] in C#
By Tan Lee Published on Jan 14, 2025 456

To deserialize an XML array into a string[] type, you can use the XmlArray and XmlArrayItem attributes.

How to Change date format using .NET Regular Expressions
By Tan Lee Published on Jan 14, 2025 315

To change a date format using .NET Regular Expressions, you follow these steps.

Handling Exceptions in .NET Core API with Middleware
By Tan Lee Published on Jan 14, 2025 496

Handling exceptions effectively in a .NET Core API is critical for providing a robust and user-friendly API.

Limits on ThreadPool.SetMinThreads and SetMaxThreads
By Tan Lee Published on Jan 14, 2025 669

In an ASP.NET Core project, managing worker threads for task execution is crucial for optimizing performance, especially when dealing with a high volume of incoming HTTP requests.

Controlling DateTime Format in JSON Output with JsonSerializerOptions
By Tan Lee Published on Jan 14, 2025 787

When building APIs with .NET Core MVC, you may want to control how your data is serialized into JSON format.

Serializing Object with Multiple String Properties to JSON Array in C#
By Tan Lee Published on Jan 14, 2025 565

If you're working with a Property class containing multiple string properties, and you need to serialize it into a JSON array where each string property becomes its own object, you're in the right place.

‘s’ is an invalid start of a value. Path: $ in ASP.NET Core
By Tan Lee Published on Jan 14, 2025 615

When working with ASP.NET Core API controllers, you might want to create an endpoint that can accept any string.

How to set data attribute in JQuery
By Tan Lee Published on Dec 11, 2024 733

In jQuery, you can set a data attribute using the .data() method or by directly manipulating the data-* attribute using .attr().

How to add class to element in Javascript
By Tan Lee Published on Dec 18, 2024 362

In JavaScript, you can add a class to an HTML element using the classList property and the add() method.