Posts Tagged ".NET"

Solving a Null Value When Posting a Simple String to a .NET Web API

The Problem: Many programmers, when creating a .NET Web API project, typically run into a situation where they want to post a simple x-www-form-urlencoded string datatype to an endpoint. They create the POST endpoint and attempt to post a string body to it only to find out that the value passed from the body is null. It can certainly be a frustrating endeavor to find a solution to this. After ...

ASP.NET Variables Won’t Hold Their Value

When it comes to working with ASP.NET most developers who have done standard desktop development always run into the problem of their class variables not retaining their values. You create a variable at the class/page level and expect that when you click a button or change a server control on the page that those variables will be there when its event is triggered. But in many cases they are not ...

Passing Data Between Forms – Using Delegates and Events

Back in an article I wrote in 2010 titled "Passing Data Between Forms in C# or VB.NET", I described one of a couple methods for passing data between two forms in a .NET forms project. One method was to publicly expose a method on a child form that the parent form could then call on when needed. At the same time I also mentioned, and advised against, using a public ...

Serializing and Deserializing XML Through a URL Endpoint in C#

Recently, at the company I work for, I had to merge two very different web sites together. While both use C#, that is where they pretty much stopped in similarity. We were exploring ways to have them talk to one another very plainly and transmit only minimal amounts of data. One website was a store which was built around the idea of digital products and it had to talk ...

Using Performance Counters in the C# Language

At any given time the Windows operating system is tracking statistics for the system and many of the processes / applications that are currently running on it. Things like the number of processors, how many threads are executing, how often the CLR is in garbage collection, the number of I/O operations being performed etc are all tracked through things called performance counters. One way you can look at these various ...

5 Quick and Easy Refactoring Tips

You wouldn't believe how many programming questions I run across, on a daily basis, asking for help with programs that contain repetition, duplication and enough spaghetti code to feed half of Italy. Often times the person asking the question has a particular problem but they don't know exactly where the problem originates. So they plop down a bunch of code and say "It is somewhere in there... I think". Usually ...