C# Programming Corner

Watch latest articles from C#
  1. Learn how to count the occurrence of each character in a string using C#. This guide covers step-by-step instructions to efficiently analyze strings and determine the frequency of individual characters.
  2. Learn how to remove duplicate characters from a string in C# with simple and effective methods. it will cover various approaches, including using loops, LINQ, and HashSet, to streamline string manipulation.
  3. Access modifiers in C# control the visibility and access of class members such as fields, properties, methods, and classes. They enforce encapsulation by defining who can access what within a class, derived classes, and across assemblies.
  4. In this article, we will learn about the potential of C#'s Dictionary collection type with this comprehensive guide. Learn essential operations, iterate through key-value pairs, and explore advanced features, empowering efficient data management in your C# applications.
  5. Learn how to identify Buzz Numbers in C# with examples. This article covers the algorithm, the program to check if a number is a Buzz Number, and how to print Buzz Numbers between 1 to 100.
  6. In this article, I will discuss the Duck Number in C# with various examples. It includes detailed explanations and practical C# implementations.
  7. In this article, I will discuss how to count the number of occurrences of a character in a string in C# with Examples. This article explores various ways to count character occurrences in a string using C#, including loops, dictionaries, and LINQ techniques, with detailed examples and practical explanations.
  8. Discover how to use threading in C# to make your applications faster and more responsive by running multiple tasks at the same time.
  9. This comprehensive guide explains NUnit testing in C# 13 with .NET 9 with detailed explanations, modern testing techniques, and practical code examples. Authored by Ziggy Rafiq.
  10. This article demonstrates how to reverse each word in a string using C#. It provides a simple approach to solving this common interview question, with code examples and explanations.
  11. In this article to implement Heap's algorithm in C# to generate all possible permutations of a sequence, we illustrated with a real-world scheduling problem example.
  12. Explore the implementation of the Round Robin scheduling algorithm in C#, designed to ensure fair CPU time allocation among processes, with a practical use case example.
  13. Implement Dijkstra's algorithm in C# to efficiently find the shortest paths in a weighted graph, enhancing your ability to solve complex pathfinding problems in various applications.
  14. In this article, I will discuss the Palindrome Program in C# (Palindrome Number and Palindrome String) with Examples. It includes detailed explanations and practical C# implementations.
  15. This article tells you how to implement and leverage binary trees in C# to optimize data storage and retrieval, ensuring your applications run smoothly and efficiently.
  16. Discover simple methods using popular programming languages like JavaScript, Python, or Java. Understand string manipulation concepts and implement effective solutions for reversing text with code examples and explanations.
  17. Learn to check if a number is a palindrome in C#. Understand what a palindrome number is and follow a step-by-step guide with code examples to implement it efficiently.
  18. Explore how to determine if a string is a palindrome in C#. Learn the concept and examples, and implement a simple solution to check palindrome strings for interview preparation.
  19. Exception handling in C# 9.0 ensures applications can manage unexpected errors gracefully, improving stability and user experience. This includes using try, catch, finally, and throw for structured error handling.
  20. This article explores the fundamentals of logging in C# 9.0, showcasing the importance of logging and how to implement it using different frameworks such as Microsoft.Extensions.Logging, NLog, and Serilog. Practical code examples illustrate how to effectively monitor and troubleshoot your applications.
  21. Learn two methods to reverse a number in C#: using arithmetic operations and `string.Reverse()`. This essential C# interview topic is explained with practical code examples and outputs.
  22. Scaffolding in C# 9.0 streamlines application development by automating code generation for controllers, views, and models. It enhances productivity with simplified syntax, improved performance, and customization options.
  23. Explore four methods to reverse a string in C#: using string.Reverse(), Array.Reverse(), for loop, and foreach loop. Ideal for interview preparation with practical examples and outputs.
  24. This article explains when to use abstract classes vs. interfaces in C# through two scenarios. The first scenario demonstrates how abstract classes help avoid code duplication, while the second shows how interfaces enable multiple inheritance.
  25. This article covers the basics, syntax, and practical use cases of nullable types, enabling you to write safer, more reliable code by avoiding null reference errors effectively.
  26. Implicitly typed variables in C#, declared using the var keyword, let the compiler infer the data type from the initialization expression. This improves code readability and reduces verbosity, especially with complex types.
  27. Often in application we come scenarios where we need to perform string manipulation operations. In such cases using string type take up huge memory as it is immutable. Instead Span can be used, which saves memory
  28. Factory Pattern is a creational design pattern that provides a way to encapsulate object creation. Instead of directly instantiating objects, you delegate the creation process to a factory class.
  29. Different techniques to display special characters and add different types of formatting to the output. This article explores C# string literals, including regular, verbatim, and interpolated strings, escape sequences, and formatting techniques like composite formatting.
  30. This article aims to provide a guided tour of some advanced topics in C# generics, such as constraints, covariance and contravariance, and custom generic interfaces.
  31. This guide covers the process of parsing Excel files, extracting data, and inserting it into a database, ensuring smooth data handling and optimization for large datasets in a seamless, automated process.
  32. With this guide, you will learn about enhanced pattern matching, static abstract members, Native AOT, and much more in C# 13 and .NET 9. Written by Ziggy Rafiq, this is the best resource for experienced .NET Software Engineer Leads.
  33. C# 13 introduces versatile features like enhanced `params` collections, scoped locking, and partial properties, boosting code flexibility, performance, and developer productivity for high-quality application development.
  34. JSON is a common data format used in APIs, configuration files, and data exchange. Learn to handle JSON in C# using `System.Text.Json`. This article covers creating data models, writing to and reading from JSON files, with practical code examples for efficient JSON management.
  35. Learn how to implement the IComparable interface in C# to customize sorting behavior for objects. Explore sorting techniques, comparisons, and examples to efficiently order data in collections like lists and arrays.
  36. Learn how to test API endpoints effectively using C# and Swagger. This guide covers setting up Swagger for API documentation, configuring C# for testing endpoints, and automating tests to ensure reliable web services.
  37. IEnumerable in C# is an interface that defines a standard way to iterate over a collection of objects. The IEnumerable interface in C# provides a standard, efficient way to iterate over collections using foreach, enabling cleaner, more readable code, and LINQ integration.
  38. In this tutorial, learn how to convert HTML to PDF or image in C# using wkhtmltopdf. This part covers adding and customizing headers and footers in your generated PDFs, enhancing document structure and appearance.
  39. This guide explains generating PDFs and images from HTML using wkhtmltopdf in C#. With wkhtmltopdf's Webkit-based engine, convert HTML content, including complex CSS and JavaScript, into high-quality PDFs or images.
  40. In this article, we will learn how to manipulate and manage in-memory data effectively, allowing for quick access and modifications while maintaining a structured format for your applications.
  41. This article provides a comprehensive overview of the ArrayIOExtensionsLib class, detailing its functionality for converting arrays to text files in C#. We explore its key features, methods, and practical applications, including data serialization and file management techniques.
  42. With Ziggy Rafiq, learn how to leverage advanced pattern matching features in C# 12, including the new let pattern and enhanced recursive patterns.
  43. To enhance application performance, reducing IO calls and utilizing stack allocation is crucial. Leveraging value types and the Span<T> structure in C# allows efficient memory management and improved speed.
  44. Encapsulation and abstraction are fundamental concepts in C# and object-oriented programming. Encapsulation refers to the bundling of data and methods that operate on that data within a class, promoting data hiding and security.
  45. Ziggy Rafiq demonstrates how to use attributes and metadata in C# 12 including improvements in parameter types, reflection capabilities, and best practices for maintaining self-documenting code.
  46. This article explores the differences between implicit and explicit interface implementation in C#. It explains how to implement an interface in two ways using classes, highlighting the accessibility of methods.
  47. C# 12 unveils a hidden gem - inline arrays. This article delves into these performance powerhouses, showcasing how they boost speed, simplify memory management, and enhance type safety. Discover their functionalities and practical applications in diverse scenarios like geometric operations.
  48. In this article, we’ll walk through how to create a generic method that can compare the objects of any class, even those with nested collections. We’ll break it down step by step so you can implement this in your projects effortlessly.
  49. Learn how to efficiently delete an element from a binary tree using C#. This guide covers the complete process of node deletion, including leaf nodes, nodes with one or two children, and root node removal.
  50. The Fibonacci series is a mathematical sequence starting with 0 and 1, where each subsequent number is the sum of the previous two. This article explores three methods to compute Fibonacci numbers in C#: recursion, memoization, and an optimal iterative approach.
  51. Learn how to efficiently find and replace text in a Word document using C#. This guide covers essential concepts such as Microsoft Word automation, leveraging the Word Interop library, and implementing simple code examples.
  52. This article describes Collections in C#. A collection is a way to create and manage groups of related objects. The group of objects can grow and shrink dynamically depending on the requirements in the collection.
  53. Learn essential string manipulation techniques, including whitespace removal, case insensitivity, and character comparison. We’ll provide clear code examples and algorithms to efficiently determine if a given string reads the same forwards and backwards, enhancing your C# programming skills.
  54. Discover the REPR Pattern, a powerful design technique tailored for C# developers. Learn how this pattern can simplify code structure, improve maintainability, and optimize performance in C# applications.
  55. In this article, we explore how Func delegates operate within LINQ (Language Integrated Query) in C#. Func delegates enable concise and powerful data manipulation by allowing developers to pass methods as parameters.
  56. This article explains how to use Func and Action delegates in C# to implement callbacks, providing flexible and reusable code. It includes practical examples for both returning and non-returning methods.
  57. In this article, we explore the distinctive features of C# generics and how they enhance programming efficiency. We compare generics with non-generic types, focusing on benefits like type safety, code reusability, and performance optimization.
  58. In this article, we will explore how these concepts drive effective software modeling, ensuring alignment between the business domain and your codebase.
  59. C#.NET applications can access OAuth-protected REST APIs. You'll obtain an access token through OAuth flow (often via a separate request) and include it in the authorization header of your HttpClient calls.
  60. Learn how to write cleaner, more maintainable code with C# 12 features such as primary constructors and improved pattern matching. This article explores practical examples and tips for applying clean code practices with C# 12.
  61. This guide provides practical C# code solutions for handling file access issues, including techniques for managing file locks and ensuring smooth file operations without interruptions.
  62. This blog explores the choice between programming languages like C#, C++, and Java, focusing on productivity, ease of use, and project requirements. It emphasizes the importance of selecting the right language for the task, the advantages of using frameworks like .NET, and considerations for team capabilities and project architecture.
  63. This article explores the concepts of Destructor and Dispose in C#. It illustrates the object's lifecycle, highlighting how constructors allocate memory and destructors clean up. The role of the Garbage Collector is discussed, emphasizing the importance of implementing IDisposable for managing unmanaged resources efficiently.
  64. This article explores the benefits of Dispose for efficient resource cleanup, improved performance, and reliable memory management in C#. Discover best practices for handling managed and unmanaged resources effectively.
  65. The Task Parallel Library (TPL) is a collection of public types and APIs within the .NET framework that facilitates the integration of parallelism and concurrency into applications.
  66. This article explores five methods for converting a C# POCO to a dictionary using reflection, LINQ, JSON libraries, and ExpandoObject, comparing their performance through Benchmark.NET to find the best approach.
  67. An indexer in C# allows objects to be indexed like arrays, enabling access to elements using an index. It’s defined with this keyword and can be used to encapsulate data access in a class or struct. Indexers enhance the flexibility and readability of code by simplifying element retrieval and storage.
  68. In C#, Action, and Func are generic delegates used to handle methods. Action is used for methods that don't return a value, while Func returns a value. Action<int> executes a method with an integer parameter without returning a result. Func<int, int> takes an integer, performs an operation, and returns the result.
  69. In C#, the Action delegate represents a method that does not return a value and can accept up to 16 parameters. It's useful for passing methods as arguments, callbacks, and event handling. It supports lambda expressions and anonymous methods, making code more concise. Unlike Func<T>, Action always returns void.
  70. In C#, the switch statement serves as a control structure that enables the execution of distinct code blocks based on the value of a variable. It is frequently utilized when there is a need to compare a variable with multiple constant values and to carry out various actions according to the outcome.
  71. A copy constructor in C# allows creating a new object by copying an existing object. It duplicates the values of properties and fields from the original object. This method is useful for creating independent object copies, enhancing code readability, and managing object duplication efficiently.
  72. Learn how to work with FTP (File Transfer Protocol) using C# in this comprehensive guide. Explore how to connect to FTP servers, upload and download files, and manage file transfers programmatically.
  73. This article describes how to implement serialization and deserialization using Protobuf-net.dll. This article explores Protobuf-net, a .NET library for efficient serialization and deserialization using Google's Protocol Buffers.
  74. In this article, we will learn how to implement this pattern in your C# code, improve code reusability, and follow best practices for more maintainable and flexible software design.
  75. Find out how Ziggy Rafiq simplifies A/B testing with feature toggles in C# 12 by using Factory and Abstract Factory design patterns.
  76. This article explores the implementation of 10 common searching algorithms in C#, detailing their use cases, workings, and complexities. From simple linear searches to more complex algorithms like Binary Search, Jump Search, and KMP, this guide provides code examples and insights into optimizing search efficiency.
  77. By Ziggy Rafiq, discover how Factory and Abstract Factory design patterns simplify the creation of complex objects in C# 12.
  78. Domain-driven design is a software development approach that closely aligns software models with business needs. It focuses on key concepts like Entities, Value Objects, Aggregates, and Aggregate Roots to ensure consistency, integrity, and scalability in complex systems by structuring code around the business domain.
  79. This guide covers the principles of object-oriented programming, including inheritance and polymorphism, and demonstrates practical techniques for effective interface re-implementation and code refactoring.
  80. This guide explores essential C# best practices for robust, maintainable code. It covers using meaningful variable names, following naming conventions, handling null values, and using var judiciously.
  81. In this detailed article by Ziggy Rafiq, you will learn how to implement key components like AbstractFactory, ConcreteFactory, AbstractProduct, and ConcreteProduct in .NET Core with C# 12. By leveraging the modern features of C# 12 and .NET Core, this pattern enhances flexibility and scalability in software development.
  82. A race condition in C# occurs when multiple threads access shared data simultaneously without proper synchronization, leading to unpredictable and incorrect results. This tutorial covers how to identify and resolve race conditions and critical section issues in multi-threaded .NET applications using the lock keyword.
  83. This article details creating a `StringUtils` utility class in Java to centralize common string operations. It covers methods for checking if a string is alphanumeric with underscores or consists solely of letters, enhancing code organization and reusability.
  84. Learn how to create a custom message box in a Windows Forms application using C#. This step-by-step guide covers everything from designing the message box to implementing it in your WinForms project.
  85. This guide explains how DIP enhances software design by decoupling high-level and low-level modules, promoting flexibility and maintainability. Understand its implementation using Dependency Injection and best practices in C#.
  86. This article explains C# basics with C# code examples including C# data types, class, objects, properties, and methods. You'll also learn basic OOP concepts such as overloading, polymorphism, abstraction, and interfaces. The article also covers common iteration statements including for, while, do while, and foreach.
  87. In multi-threaded C# programming, the lock statement ensures that critical code sections are accessed by only one thread at a time. While lock(this) locks on the current instance, it can expose your object to external locking, leading to potential deadlocks.
  88. The [Flags] attribute in C# allows an enum to represent a combination of values using bitwise operations. This is useful when an enum needs to store multiple values simultaneously. By applying [Flags], enum members can be combined using bitwise OR, and specific values can be checked with bitwise AND or HasFlag.
  89. Explore the Interface Segregation Principle (ISP) from SOLID design principles to ensure code flexibility and maintainability. ISP advocates for breaking down large, unwieldy interfaces into smaller, client-specific ones, reducing unnecessary dependencies. Learn how to apply this principle with practical examples in C#.
  90. An in-depth look at performance enhancements, language improvements, and new libraries in this comprehensive article by Ziggy Rafiq.
  91. This guide explores the detailed use of Tuples and ValueTuples in C#. It covers their differences, how to create and manipulate them, and practical examples for implementing them in real-world applications.
  92. In this article we can learn how to make our own QR code. Make a QR report using RDLC reports with preview condition.
  93. Learn how records differ from classes, their advantages in creating immutable types, and how they enhance object initialization, equality checks, and more in .NET applications.
  94. The Liskov Substitution Principle (LSP) ensures that objects of a base class can be replaced with objects of a derived class without altering program correctness. This principle, part of SOLID design, promotes reliable and maintainable code by maintaining consistent behavior across class hierarchies.
  95. Server-Sent Events (SSE) in C# .NET enable real-time, one-way communication from server to client over HTTP, ideal for live updates like notifications or data streaming. Unlike WebSockets, SSE is simpler, requiring only server-side implementation.
  96. This article explores how the yield return statement in C# can simplify iteration logic and enhance code quality. By allowing deferred execution and creating custom iterators, developers can write more efficient and readable code.
  97. The Open/Closed Principle (OCP) states that software entities should be open for extension but closed for modification. This principle helps in creating flexible and maintainable code by allowing new functionality to be added without altering existing code.
  98. In this article, we will look into automation of Tortoise SVN activities like checkout, delete, rename on a SVN repository using C# in a console application.
  99. This article explores how to leverage C# records for implementing Data Transfer Objects (DTOs) in .NET. It delves into the benefits of using records for immutable data structures, enhancing code readability, and reducing boilerplate.
  100. This article covers using Func, Action, and local functions in C# 7. It explains how Func returns a value, Action does not, and how local functions can be defined within other methods. Examples include checking for prime numbers, printing the Fibonacci series, and calculating factorials.