Skip to content

C# Examples

  • Home
  • About C#
    • C# Interview Questions and Answers for .NET Developers
    • Learn C#: A Practical Path Through the Examples
  • All Posts
  • Bootstrap 5 Examples
  • Contact

turgay

C# yield return and yield break: Writing Iterators

November 25, 2026September 11, 2014 by turgay

How yield return and yield break turn a method into a lazy iterator in C#, with examples, async iterators, and the traps around deferred execution.

Categories C# .NET Tags C#, yield, yield keyword Leave a comment

Send an Email with an Attachment from Gmail in C#

November 25, 2026September 10, 2014 by turgay

Send email with attachments through Gmail from C# using MailKit and an app password, plus the OAuth 2.0 option and notes on legacy SmtpClient code.

Categories C# .NET Tags C#, Send an Email with Attachment, send email, send email using gmail, send mail Leave a comment

Send an Email with an Attachment from Outlook.com (Hotmail) in C#

November 25, 2026September 10, 2014 by turgay

Outlook.com and Hotmail no longer accept passwords over SMTP. Send email with attachments from C# using MailKit and an OAuth 2.0 token from MSAL.

Categories C# .NET Tags C#, Send an Email with Attachment, send email, send email using hotmail, send mail Leave a comment

Send an Email with an Attachment from Yahoo Mail in C#

November 25, 2026September 10, 2014 by turgay

Send email with attachments through Yahoo Mail’s SMTP server from C# with MailKit and a Yahoo app password, without hard-coding credentials.

Categories C# .NET Tags C#, Send an Email with Attachment, send email, send email using yahoo, send mail 2 Comments

Optional Parameters and Named Arguments in C#

November 25, 2026September 9, 2014 by turgay

How to declare optional parameters with default values in C#, call them with named arguments, and avoid the versioning trap that comes with them.

Categories C# .NET Tags C#, C# 4.0, optional argument, optional parameter Leave a comment
Older posts
Newer posts
← Previous Page1 Page2 Page3 Page4 … Page21 Next →

Categories

Recent Posts

  • Select XML Nodes by Name or Attribute Value in C#
  • Binary Search Tree in C#: Add, Find, Remove and Traversals
  • Select, Insert, Update and Delete Data in an Access File with C#
  • C# Collections: Which One to Use and When
  • C# ArrayList vs Generic List: Examples and When to Use Each
  • About
  • Privacy Policy
  • Contact
© 2026 C# Examples