In Entity Framework, "decimal" has 0 in its scale by default. For example, if you s...
In my previous post How to get unix timestamp in C#, I explained how to use unix time...
.NET Core 3.0 introduced System.Text.Json namespace which includes some of JSON class...
How do I avoid hardcoded connection string in my DbContext class? using Microsoft....
Here is a simple example that shows how to use stored procedure in Entity Framewor...
I needed to add quick and dirty ad hoc log to staging/test web server. For quick a...
This is not C# topic, but you might be interested since it is pretty tricky case. ...
Application Settings allows you to store and retrieve property settings and other inf...
Problem One of my blog readers asked why he was unable to call Control.Invoke() i...
Problem I downloaded an ASP.NET Core 2.1 project. When I opened the project with ...
Problem I created new ASP.NET Core 2.1 project in VS 2017. Project build was succ...
Problem How to get the current date and time from internet? Solution Ther...
Problem When I copy a working C# application to another machine, I ran into the fo...
Problem How to download tabular data such as DataTable data in Excel CSV/TSV form...
Problem How can we scroll a panel using mouse wheel in WinForms? Solution ...
Problem How to check if query string in URL contains potential XSS characters? ...
Problem How to add NumericUpDown control in WPF DataGrid? How to use One ...
Problem When expanding [Tables] node of SQL Server from [Server Explorer] in Visu...
CLR version vs .NET version CLR version and .NET version are different and somet...
Problem When ASP.NET/.NET Core 2.0 web application is deployed to IIS Server, the ...
When using Lambda expression, we generally use parameters without specifying their ty...
1. Entity Framework 6 (EF6) uses LocalDB by default. When EF6 is installed (typi...
Problem Ran into the following error when tried to PUBLISH my ASP.NET Core web pr...
C# 7.0 introduced "ref return" which allows a method to return "ref" of a value. Som...
In MVC, how to allow HTML string in POST action?...
Some HTTP headers sent by IIS web server disclose server information. And he...
Sometimes I make mistakes not escaping curly brace in string formatting. For example,...
In Entity Frame 5, default precision for decimal property is (18, 2) which means prec...
GUID is 128 bit (16 bytes) data. To convert GUID to integer without data loss, we c...
When I tried to build a C# project, I ran into the following error. The "Generat...
When a reference type object is passed to another method, one can add "ref" keyword i...
How do you restart the current process in C#? Well basically it is to start the...
A Simple example of calling a SQL function by using ADO.NET. While it is not com...
In C#, we can check to see if a string is null or an empty string as follows. if...
When running the following code in standalone application, it works fine. stri...
Sometimes people asked some questions on one of my old blog - "VS 2012 Error : Coul...
In C#, foreach statement provides a convenient way of iterating an enumerable object....
One of great features in Vistual Studio... Search Solution Explorer! On top of S...
A question from facebook group:How can we get process handle or process id from runni...
I ran into an error when using the following string formatting. // Wrong var s ...
A small note for how to debug a website (ASP.NET) hosted in remote test server. ...
Since .NET 2.0, there is a method called NetworkInterface.GetIsNetworkAvailable() whi...
Sometimes we want to know the size of HTTP resource before actually getting it. For e...
How to convert long date string to short date strong? Let's say we got a date stri...
If you frequently update the content of a WinForms Control, you might observe a flick...
.NET 4.0 (or below) supports SSL 3.0 and TLS 1.0 (a successor of SSL 3.0). SSL and TL...
In CLR, the primitive types are Boolean, Byte, SByte, Int16, UInt16, Int32, UInt32, I...
When it comes to multi-dimensional array, C# supports two kinds of multi-dimensional ...
.NET Framework does not have handy way of emptying the Recycle Bin files. But this ta...
Someone in Facebook asked a question, 'where can I find .NET Framework source cod...
In C/C++, union is a user-defined type in which all members share the same memory, bu...
I have Order and OrderDetails table which has one to many relationship. How do I ...
I ran into equality operator (==) issue again. That is, when equality operator compar...
It is not unusual for C# developer to mix DBNull up with pure "null." Tak...
Visual Studio 2015 (RTM) provides ASP.NET 5 Preview Template and this project templat...
When comparing parameter with literal value, it is common to make it to uppercase or ...
.NET String class has ToUpper() method which changes all characters to uppercase and ...
Ping is typically used to check a computer's availablity. Ping uses ICMP echo req...
In C#, DateTime struct does not have any method to set system time. How can we change...
To round up a number, C# uses a .NET method called Math.Round(). For example, Math.Ro...
We might want to wipe a file completely so that the file can never be recovered. Som...
How can I fade in and/or fade out my form (WinForms)?...
How can we show user-defined string for enum value? For example, want to display &quo...
Entity Framework has an annotation (StringLength) to set max length of string field. ...
In C# desktop application, how can we launch browser and navigate to a specifc web si...
Bug Fix: Invalid viewstate / Unable to find assembly An exception was thrown fr...
An interesting question: is it possible to access property or method when int? value ...
This is about a bug that I found recently. One component calling other company...
Sometimes we need to convert byte array to a concatenated hex string. Nice thing abou...
The unix time stamp is the number of seconds between a particular date and the Unix E...
I want to capture the entire screen from my winform application. I have a button ...
One interesting way of finding an element index of a list using LINQ. Enumerable...
A question from a Facebook C# group. How can we get around the ambiguous method o...
Sometimes Web API can return money data as an integer. For example, Stripe API (f...