Category Archives: C#

Feature Debugging flags

I chuckled today when I received an add from launchdarkly.com. They’re a “feature flag” SaaS provider. I explained the concept of feature flags to a non-software-developer just a few weeks ago, so maybe my phone was eavesdropping. I was amused … Continue reading

Posted in C#, Musings, Programming | Leave a comment

Open the application folder, Hal.

Some applications *cough ClickOnce cough cough* hide in difficult-to-find folders, with auto-generated paths that include GUIDs. Here’s an easy way to open the application folder, and also the config file. And the local application data folder, because of course you’re … Continue reading

Posted in C#, Programming | Leave a comment

Simplified switch

I commonly included this code at the end of a C# switch statement, in a misguided effort to proactively satisfy the syntax of the switch statement: switch (contentType) { case FraMES.ContentTypes.Something: do stuff for Something; break; default: throw new Exception(“FraMES.ThisMethod … Continue reading

Posted in C#, Programming | Leave a comment

C# Pragma to disable unused constants

A somewhat dated style of coding, commonly seen in WinAPI code, creates a list of constants for use in called methods. Occasionally I find this concept handy and illustrative, such as when using 32-bit resources because the 64-bit equivalent is … Continue reading

Posted in C#, Programming | 1 Comment

Updating nullable DataTable columns

While NULL is a standard feature and business-as-usual in the SQL world, and likewise null objects are common in the C# world, the concept of NULL and null are completely different things and the translation is easily forgotten. This is … Continue reading

Posted in C#, Programming, SQL Server | Leave a comment

Display a Tooltip when the user hovers the mouse over a control

AKA mouseover, hovertext. To display a message over one specific control             string message = WORKCENTERS_FOR_ROUTESTEP_STRING + lbRouteSteps.SelectedItem.ToString();             lblSelectedRouteStep.Text = message;             System.Windows.Forms.ToolTip ToolTip1 = new System.Windows.Forms.ToolTip();             ToolTip1.SetToolTip(this.lblSelectedRouteStep, message); For displaying over multiple controls on a form Instantiate … Continue reading

Posted in C#, Programming | Leave a comment

End of Line

StringBuilder sb = new StringBuilder(“Part of some text”); sb.AppendLine(); // adds a Windows-style CRLF end-of-line. /r/n is Windows-style. That’s ASCII 13, ASCII 10. The great drscoinc.com cialis generika condition implies to unevenness of reproductive health and emotional health professionals, they … Continue reading

Posted in C#, Programming | Leave a comment

Change a DataTable cell value

This is stupid simple, but it’s so stupid simple that I forget about it.

Posted in C#, Programming | Leave a comment

C# name of calling method plus current method

StackTrace st = new StackTrace(); throw new NotImplementedException(st.GetFrame(1).GetMethod().Name + “.” + System.Reflection.MethodBase.GetCurrentMethod().Name + ” is not yet implemented.”);

Posted in C#, Programming | Leave a comment

Retrieve a null database value into a GUID variable using C#

Guid aca_coc_signature_id = (dtDocument.Rows[0].Field<Guid?>(“aca_coc_signature_id”)); The type decorator “?” makes the Guid nullable. Another approach is: if (dtDocument.Rows[0].IsNull(“aca_coc_signature_id”)) { aca_coc_signature_id = System.Data.SqlClient.Guid.Null; } There are more than 100 types of arthritis. viagra 25 mg offscriptband.com This medicine works wonders only if … Continue reading

Posted in C#, Database, Programming | Leave a comment