c#
Although I love strings, sometimes the String class can break your heart. For example, in C#, there is no String.Left() function. Fair enough; we can roll up our sleeves and write our own function lickety-split:
public static string Left(string s, int len)
{
if (len == 0 || s.Length == 0)
c#
I sometimes (often, actually) regress a few years mentally and forget to take advantage of new features afforded by the tools I'm using. In this case, we're using the latest and greatest version of C#, which offers implicitly typed local variables. While working on Stack Overflow,
c#
In C# and the Compilation Tax, several commenters noted that they have “fast dual-core computers,” and yet background compilation performance was unsatisfactory for them on large projects. It’s entirely possible that this is Visual Studio’s fault. However, I’d like to point out that not all dual core
c#
Over the last four years, I’ve basically given up on the idea that .NET is a multiple language runtime.
* The so-called choice between the two most popular languages, C# and VB.NET, is no more meaningful than the choice between Coke and Pepsi. Yes, IronPython and IronRuby are meaningfully
filepaths
I recently imported some source code for a customer that exceeded the maximum path limit of 256 characters. The paths in question weren’t particularly meaningful, just pathologically* long, with redundant subfolders. To complete the migration, I renamed some of the parent folders to single character values.
This made me
programming languages
Though I’ve become agnostic about the utterly meaningless non-choice between VB.NET and C#, the inherited syntax of C leaves a lot to be desired, in my opinion. And not just in the case sensitivity department. Daniel Appleman, in his excellent e-book, VB.NET or C#, Which to Choose?
c#
If you need to store a little bit of state – in your configuration file, or on disk – nothing is faster than some quick and dirty serialization. Or as I like to call it, stringization.
In late 2004, I wrote about The Last Configuration Section Handler, which does exactly this for
c#
Here’s a question that recently came up on an internal mailing list: how do I create an enum with a name that happens to be a c# keyword?
I immediately knew the answer for VB.net; you use brackets to delimit the word.
Public Enum test
[Public]
[Private]
End
c#
Microsoft recently released a complete set of C# code snippets for Visual Studio 2005. This brings C# to parity with VB.NET, which had many more code snippets “in the box.”
Unfortunately, Microsoft’s installation strategy for these new snippets leaves a lot to be desired. You can download and
.net
I’ve increasingly come to believe that the debate between C# and VB.NET is a red herring. Choosing between C# and VB.NET isn’t a meaningful choice. It’s like choosing between .NET Pepsi and .NET Coke.
Either way, you’re getting a cola flavored carbonated beverage.
If
html cleaning
I recently wrote a Word 2003 document that I later turned into a blog post. The transition between Word doc and HTML presented some problems. Word offers two HTML options in its save dialog: “Save as HTML” and “Save as Filtered HTML.” In practice, that means you get to choose