Letters from Readers

Letters: Looking into Lambdas

C# Corner columnist Patrick Steele recently explored the idea of using lambda methods as a way to plug in specific functionality with more control than subclassing ("Lambda Properties: An Alternative to Subclassing?" June 2011). Readers respond:

I think this is a great idea for those edge instances where you need a slight variation for one or two places in the code and creating an entire subclass is more work than it's worth.

Sean Cooper
Chicago, Ill.

I agree with Sean. While you wouldn't want to replace inheritance with this approach, I can see the power of it. It's certainly something that I'll keep in mind as I develop -- especially when writing unit tests. Thanks!

Reese
Spokane, Wash.

I would opt for creating methods that take a Func as a parameter. This is an example of the Strategy pattern.

Robert Zurer
New York, NY

Missing Tools
What about NuGet? And ReSharper [missing from the June 2011 "Visual Studio Toolapalooza"]?

Bill Mild

Peter Vogel responds: I'm a big fan of ReSharper, but it doesn't have a free version (at least, not one I could find). And I was going to include NuGet, but Ian Davis beat me to it in his recent Open Source .NET column online. So I was out of luck. They're still great tools, though.

If you just want to dump the e-mail to a folder, you don't need a program to do that. Just set the SmtpClient's DeliveryMethod property to SpecifiedPickupDirectory, and set the PickupDirectoryLocation property to the path where you want the files to be generated. (You can even do this in the config file for a no-code change.) The generated files will be standard EML files, which you can open with Outlook Express or Windows Live Mail.

Richards

Peter Vogel responds: There's nothing wrong with setting the DeliveryMethod property -- provided, of course, you remember to change the setting before releasing to production (let's not ask why I know this). But I still need to either use some client to view the mail or find my way to the folder to check my results. The nice thing about tools like papercut and smtp4dev is that they come with a client and the client sits right in the tray, making it easy to see my results.

About the Author

This story was written or compiled based on feedback from the readers of Visual Studio Magazine.

comments powered by Disqus

Featured

  • VS Code 1.123 Adds Agent Session Sync, 1M Context Windows

    Microsoft released Visual Studio Code 1.123 on June 3, adding agent-focused features, larger model context support, integrated browser updates and a new delay for some automatic extension updates.

  • Copilot Billing Shock Hits Developers

    Developer complaints about GitHub Copilot's new usage-based billing model have centered on unexpectedly rapid AI credit consumption, and neither GitHub nor Microsoft has responded directly to the backlash, though they have previously published guidance to lessen model usage costs.

  • Hands On with GitHub Copilot App Technical Preview: Turning a Blazor Issue into a PR

    GitHub's brand-new Copilot desktop app, in technical preview, handled a small Blazor issue from planning through pull request creation, but the hands-on test also showed why developers still need to verify agent work in the running app before merging.

  • At Build 2026, Microsoft Sets Up Windows as an OS for AI Agents

    Microsoft's Build 2026 Windows developer announcements point to a broader platform strategy for agentic AI, spanning terminal workflows, local models, app-building skills, Cloud PCs and operating system-level containment.

Subscribe on YouTube