Programming Articles

Page 873 of 2547

How to count the number of items in a C# list?

George John
George John
Updated on 17-Mar-2026 1K+ Views

The Count property in C# is used to determine the number of elements in a List. This property returns an integer representing the total count of items currently stored in the list. Syntax Following is the syntax for using the Count property − int count = myList.Count; Parameters The Count property does not take any parameters. It is a read-only property that returns the current number of elements in the list. Return Value The Count property returns an int value representing the number of elements in the list. It returns 0 ...

Read More

How to print a blank line in C#?

karthikeya Boyini
karthikeya Boyini
Updated on 17-Mar-2026 3K+ Views

To print a blank line in C#, you can use several methods. The most common approach is using Console.WriteLine() without any parameters, which outputs an empty line to the console. Syntax Following are the different ways to print a blank line − Console.WriteLine(); // Empty line Console.WriteLine(""); // Empty string Console.WriteLine(" "); // Single space Console.Write(""); // Newline character ...

Read More

C# program to concat two or more Lists

Chandu yadav
Chandu yadav
Updated on 17-Mar-2026 305 Views

In C#, you can concatenate multiple List objects using the Concat() method from LINQ. This method creates a new sequence that contains all elements from the original lists in order without modifying the original lists. Syntax Following is the syntax for concatenating lists using the Concat() method − var result = list1.Concat(list2); For multiple lists, you can chain the Concat() calls − var result = list1.Concat(list2).Concat(list3); Using Concat() to Merge Two Lists Example using System; using System.Collections.Generic; using System.Linq; public class Demo { ...

Read More

C# All method

Arjun Thakur
Arjun Thakur
Updated on 17-Mar-2026 3K+ Views

The All() method in C# is a LINQ extension method that checks whether all elements in a collection satisfy a given condition. It returns a bool value − true if all elements meet the condition, or false if even one element fails the condition. The method is available for any IEnumerable collection and is commonly used with arrays, lists, and other collections for validation and filtering operations. Syntax Following is the syntax for the All() method − bool result = collection.All(predicate); Parameters predicate − A lambda expression or delegate that ...

Read More

Comparison between C# and .NET Framework

Arjun Thakur
Arjun Thakur
Updated on 17-Mar-2026 711 Views

C# is a programming language, while the .NET Framework is a comprehensive software development platform created by Microsoft. Understanding the relationship between these two is fundamental for .NET developers. The .NET Framework provides the Common Language Runtime (CLR), which serves as the execution environment for .NET applications. It also includes an extensive Base Class Library (BCL) that offers pre-built functionality for common programming tasks. What is C#? C# is an object-oriented programming language that runs on the .NET Framework. It was designed specifically for the .NET platform and compiles to Intermediate Language (IL) code, which the CLR ...

Read More

Convert.ToByte(String, IFormatProvider) Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 607 Views

The Convert.ToByte(String, IFormatProvider) method in C# converts the specified string representation of a number to an equivalent 8-bit unsigned integer, using specified culture-specific formatting information. This method is particularly useful when working with string data from different cultures that may use different number formats, such as different decimal separators or thousand separators. Syntax Following is the syntax − public static byte ToByte(string value, IFormatProvider provider); Parameters value − A string that contains the number to convert. The value must be between 0 and 255. provider − An object ...

Read More

How to print a BinaryTriangle using C#?

Arjun Thakur
Arjun Thakur
Updated on 17-Mar-2026 641 Views

A binary triangle is a pattern formed using alternating 0s and 1s arranged in a triangular shape. Each row contains an increasing number of digits, and the pattern alternates between 0 and 1 for each position across all rows. How It Works The binary triangle is created using nested loops where the outer loop controls the number of rows, and the inner loop prints the alternating 0s and 1s for each row. A toggle variable switches between 0 and 1 to create the alternating pattern − Binary Triangle Pattern 1 ...

Read More

C# program to find common values from two or more Lists

George John
George John
Updated on 17-Mar-2026 540 Views

Finding common values from two or more Lists in C# is a frequent requirement in programming. The Intersect() method from LINQ provides an efficient way to identify elements that exist in multiple collections. Syntax Following is the syntax for using Intersect() method − var result = list1.Intersect(list2); For multiple lists, chain the Intersect() method − var result = list1.Intersect(list2).Intersect(list3); Using Intersect() with Two Lists The Intersect() method returns elements that appear in both lists. It automatically removes duplicates and maintains the order from the first list − Example ...

Read More

Difference between namespace in C# and packages in Java

Samual Sam
Samual Sam
Updated on 17-Mar-2026 4K+ Views

Both C# namespaces and Java packages are used to organize code and prevent naming conflicts, but they have different features and implementations. Understanding their differences helps developers work effectively in both languages. Packages in Java Packages in Java are used to prevent naming conflicts, control access, and make searching and locating classes, interfaces, enumerations, and annotations easier. Java packages also provide access control through package-private visibility. Java Package Syntax package package_name; Example // Java equivalent concept in C# using System; namespace Company.Project.Utilities { public class Calculator { ...

Read More

Char.ConvertFromUtf32(Int32) Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 494 Views

The Char.ConvertFromUtf32(Int32) method in C# converts a specified Unicode code point into a UTF-16 encoded string. This method is particularly useful when working with Unicode characters that may be represented as numeric code points and need to be converted to their corresponding string representation. Syntax Following is the syntax − public static string ConvertFromUtf32(int utf32); Parameters utf32: A 21-bit Unicode code point representing a valid Unicode character. The valid range is from 0x000000 to 0x10FFFF, excluding the surrogate pair range (0xD800 to 0xDFFF). Return Value Returns a string object consisting of ...

Read More
Showing 8721–8730 of 25,466 articles
« Prev 1 871 872 873 874 875 2547 Next »
Advertisements