Skip to content
Archive of posts filed under the C# category.

Getting to know Resharper: Generate a constructor

Resharper, the terrific Visual Studio productivity plugin, reduces adding a constructor for class, with as many arguments as you need, to just a few mouse clicks.Here’s how to use this Resharper feature.
Figure 1a. Class without a constructor.

1public class Artist
2{
3 public int ArtistId { get; set; }
[...]

Using Linq to create an ADO.NET connection string

I know I’m a little late to the party, but I am quickly falling in love with Linq. Once you start adopting its functional mindset, it is so expressive and direct.
I once heard someone way that once you really get Linq, you’ll won’t ever need to write a For/Each loop again. Probably an overstatement, [...]

Getting a list of installed Windows printers

For printing tasks, it’s common to need to fetch the list of currently installed printers on a given PC. The Windows’ PrintDialog does display available printers—but it’s generally intended to be used in the general workflow of printing a document. The PrintDialog is also no help whatsoever for browser-hosted intranet apps where a user needs [...]