Showing posts with label c#. Show all posts
Showing posts with label c#. Show all posts

Send asynchronous e-mail in C#

When developing an application, we generally use an auto e-mail functions to send notification, information, etc. to user. When sending an e-mail in C# we use System.Net.Mail Namespace and SmtpClient Class to send the specified message to a SMTP server for delivery. But, Send method is a synchronous method. It means, send method blocks while the e-mail is transmitted and user waits for the response and also ui is blocked.

MD5 hashing in C#

Here is the Encrypt function for MD5 hashing that i have coded. I hope it is useful for you.

C# and NumberDecimalSeparator

When developing an application with C# (also VB), decimal separator can be a nightmare for developer. User can enter a numeric value with dot or comma. Like 2.5 or 2,5

When we try to parse this value to a numeric value, user separator can be a problem.

C# and ConvertToNullable

Time to time, we need to convert values to another variable type. For example, when we save the product price, we need to convert string value to numeric value that is entered from user interface. Also, time to time we need to convert value to null value and save it as a null. For example, user creates a product from user interface but there is no discount value for this product. And we want to save discount value as a null.