C# Programming Corner
Watch latest articles from C#
-
How To Count Occurrence Of Each Character From The String In C#
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. -
How To Remove Duplicate Characters From String In C#
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. -
Understanding Access Modifiers in C#
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. -
Understanding Dictionary in C#
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. -
Understanding Buzz Number in C#
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. -
Explaining Duck Number in C#
In this article, I will discuss the Duck Number in C# with various examples. It includes detailed explanations and practical C# implementations. -
Character Occurrence in a String in C#
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. -
Enhancing Performance and Responsiveness Using Threading in C#
Discover how to use threading in C# to make your applications faster and more responsive by running multiple tasks at the same time. -
The Complete Guide to NUnit Testing in C# 13 and .NET 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. -
How To Reverse Each Word Of Given String
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. -
Generating Permutations Efficiently in C# with Heap's Algorithm
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. -
Efficient Task Scheduling with Round Robin Algorithm in C#
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. -
Implementing Dijkstra's Algorithm in C#
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. -
Explaining Palindrome Program in C#
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. -
Efficiently Managing Data with Binary Tree Implementation in C#
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. -
How to Reverse Order of the Given String
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. -
Palindrome Number in C#
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. -
Palindrome String Program in C#
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. -
Exception Handling in C# 9.0
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. -
Implementing Logging in C# 9.0
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. -
How to Reverse Number in C#
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. -
Scaffolding in C# 9.0: Building Fast & Efficient Code Structures
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. -
How to Reverse a String in C#?
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. -
When to Use Abstract Class vs Interface and Why?
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. -
C# Foundation - Nullable Types
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. -
C# Foundation - Implicitly Typed Variables
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. -
High-Performance Apps Using C# Span<T>
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 -
Factory Design Pattern Using Delegates In C#
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. -
Format Literal Strings in C#
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. -
Exploring Advanced Generics in C#: A Practical Guide with Examples
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. -
Bulk Import of ID Card Data from Excel in ASP.NET MVC C#
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. -
Advanced C# 13 and .NET 9 Features for Expert .NET Engineers
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. -
What's New in C# 13?
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. -
How to Read and Write JSON Files in C#
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. -
Sorting with IComparable in C#
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. -
Testing API Endpoints Using C# and Swagger
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. -
Understanding IEnumerable In C#
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. -
Converting HTML to PDF or Image in C# Using wkhtmltopdf Part 2 - Header & Footer
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. -
Converting HTML to PDF or Image in C# Using wkhtmltopdf
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. -
How to Store Temporary Information in Table Like Format in C#?
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. -
Array to Text File: Detailed Overview of ArrayIOExtensionsLib Class
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. -
An in-depth Look at Advanced Pattern Matching in C# 12
With Ziggy Rafiq, learn how to leverage advanced pattern matching features in C# 12, including the new let pattern and enhanced recursive patterns. -
Using Span<T> To Improve Performance Of C# Code
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. -
Encapsulation vs Abstraction in C#
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. -
Using Attributes and Metadata in C# 12
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. -
Implicit vs Explicit Interface Implementations
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. -
What is Inline Arrays in C# 12
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. -
How to Compare Two Objects in C#
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. -
Delete the Element from the Binary Tree Using C#
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. -
Fibonacci Series : Recursion, Memoization, and Optimal Approach
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. -
Find And Replace Text In Word Document Using C#
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. -
Collections in C#
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. -
Palindrome Check: Normalize Strings in C#
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. -
REPR Pattern - For C# Developers
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. -
How Func Delegates Work in LINQ
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. -
Understanding Callbacks with Func and Action Delegates
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. -
How C# Generics is different from Java Generics
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. -
Understanding Key Concepts in Domain-Driven Design
In this article, we will explore how these concepts drive effective software modeling, ensuring alignment between the business domain and your codebase. -
C#.NET - Access OAuth REST Web API Method
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. -
Using C# 12 with Clean Code Practices
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. -
C# Code To Overcome "The Process Cannot Access The File XYZ Because It Is Being Used By Another Process" Error
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. -
Why To Use C# And When To Prefer Other Languages
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. -
Cleaning the Resources: Finalize vs Dispose
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. -
Why We Should Prefer To Use Dispose Method Than Finalize Method
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. -
An overview of the Task Parallel Library (TPL) in C#
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. -
POCO to Dictionary Conversion Techniques in C#
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. -
What is Indexer in C#?
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. -
Action And Func Delegates In C#
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. -
Detailed use of Action Delegate in C#
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. -
Explain Switch Case Uses in C#
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. -
Exaplain Copy Constructor in C#
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. -
Working With FTP Using C#
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. -
Serialization And Deserialization In C# Using Protobuf-net.dll
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. -
A Guide to Using the Decorator Pattern in Your C# Code
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. -
Using Factory Patterns in C# 12 to simplify A/B testing
Find out how Ziggy Rafiq simplifies A/B testing with feature toggles in C# 12 by using Factory and Abstract Factory design patterns. -
Optimizing Searching Algorithms in C# and Reducing Complexities
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. -
C# 12 Design Patterns: Factory and Abstract Factory
By Ziggy Rafiq, discover how Factory and Abstract Factory design patterns simplify the creation of complex objects in C# 12. -
Understanding of Domain Driven Design (DDD)
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. -
Interface Re-implementation in C#
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. -
Crafting Efficient and Maintainable C# Code
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. -
Abstract Factory Design Pattern in .NET Core C# 12
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. -
Resolving Race Conditions and Critical Sections in C#
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. -
Default Implementation in C# Interfaces
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. -
How to Create a Custom Message Box in Windows Form Application
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. -
Understanding Dependency Inversion Principle (DIP) with C#
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#. -
Basics Of C#
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. -
Difference between lock(this) and lock(privateObj) in C#
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. -
Understanding the Flag Enums in C#
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. -
Understanding the Interface Segregation Principle (ISP) with C#
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#. -
Code Examples for .NET 8 Features with C# 12
An in-depth look at performance enhancements, language improvements, and new libraries in this comprehensive article by Ziggy Rafiq. -
Detailed use of Tuples and Value Tuples in C#
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. -
Create QR Code Report Using RDLC Report With Preview
In this article we can learn how to make our own QR code. Make a QR report using RDLC reports with preview condition. -
Understanding the Record in C#
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. -
Understanding the Liskov Substitution Principle (LSP) with C#
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. -
Learn Server-Sent Events in C# .NET
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. -
Iterations and Improving Code Quality with C# yield return
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. -
Understanding the Open/Closed Principle (OCP) with C#
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. -
Tortoise SVN Automation Using C#
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. -
Leveraging Records for Data Transfer Objects (DTOs) in C# .NET
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. -
Func, Action And Local Function In C# 7
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.