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

Update the UI from Another Thread in C# (WinForms)

November 25, 2026June 25, 2014 by turgay

Fix “cross-thread operation not valid” in WinForms with async/await, IProgress and Control.Invoke or BeginInvoke, and know which one to use when.

Categories C# .NET, WinForms Tags C#, thread, update gui element, update label from another thread Leave a comment

Murphy’s Laws of Programming

November 25, 2026June 25, 2014 by turgay

A short, slightly cynical collection of Murphy’s Laws for programmers: bugs, deadlines, documentation and the code nobody wants to touch.

Categories Miscellaneous Tags computer programming, murphy laws, software engineering Leave a comment

Expose a Read-Only Collection in C# with AsReadOnly

November 25, 2026June 24, 2014 by turgay

Let callers read a private list without changing it, using AsReadOnly and IReadOnlyList, and why returning IEnumerable alone does not protect it.

Categories C# .NET Tags C#, read only collection, readonly wrapper collection Leave a comment

Email Validation in C#: Regex, MailAddress and Their Limits

November 25, 2026June 23, 2014 by turgay

Check that a string looks like an email address in C# with MailAddress.TryCreate or a simple source-generated regex, and why no regex can fully validate one.

Categories C# .NET Tags C#, email validation, regular expression Leave a comment

Disable or Hide the Close Button (X) on a Windows Form in C#

November 25, 2026June 23, 2014 by turgay

Gray out or remove the close button of a WinForms window with CreateParams or ControlBox, and stop the form from closing anyway with FormClosing.

Categories C# .NET, WinForms Tags C#, disable close button, hide close button 6 Comments
Older posts
Newer posts
← Previous Page1 … Page14 Page15 Page16 … 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