Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Programming Articles
Page 851 of 2547
Log functions in C#
With C#, you can easily work with logarithms using the Math class. It provides several methods to calculate logarithms with different bases, including natural logarithms (base e) and common logarithms (base 10). Available Log Methods Method Description Log(Double) Returns the natural (base e) logarithm of a specified number. Log(Double, Double) Returns the logarithm of a specified number in a specified base. Log10(Double) Returns the base 10 logarithm of a specified number. Syntax Following are the syntax forms for logarithm methods − ...
Read MoreMedium-Earth Orbit Satellites
This article appears to be about satellite orbits, not C# programming. As a C# tutorial enhancement specialist, I can only improve C# programming articles for TutorialsPoint.com. Please provide a C# programming article that needs improvement, such as topics related to: C# language features (classes, methods, properties, etc.) .NET Framework concepts Object-oriented programming in C# C# syntax and programming constructs C# libraries and APIs I'll be happy to enhance any C# programming tutorial following the TutorialsPoint standards with proper code formatting, examples, and structure.
Read MoreC# program to get the extension of a file in C#
The Path.GetExtension() method in C# is used to extract the file extension from a file path. This method is part of the System.IO namespace and returns the extension portion of the path string, including the period (.). Syntax Following is the syntax for using Path.GetExtension() method − public static string GetExtension(string path) Parameters path: A string containing the file path from which to get the extension. Return Value The method returns a string containing the extension of the specified path (including the period), or an empty string if the ...
Read MoreC# Linq Except Method
The Except() method in LINQ is used to find the set difference between two collections. It returns elements from the first collection that are not present in the second collection, effectively performing a set subtraction operation. Syntax Following is the syntax for the Except() method − public static IEnumerable Except( this IEnumerable first, IEnumerable second ) With custom equality comparer − public static IEnumerable Except( this IEnumerable first, IEnumerable second, IEqualityComparer comparer ...
Read MoreDecimal.CompareTo() Method in C#
The Decimal.CompareTo() method in C# is used to compare the current decimal instance with another decimal value or object. It returns an integer that indicates whether the current instance is less than, equal to, or greater than the comparison value. Syntax The Decimal.CompareTo() method has two overloads − public int CompareTo(decimal value); public int CompareTo(object value); Parameters value − A decimal number or object to compare with the current instance. Return Value The method returns an int value indicating the comparison result − Less than zero − ...
Read MoreC# program to Reverse words in a string
In C#, reversing words in a string means reversing each individual word while keeping the words in their original positions. For example, "Hello World" becomes "olleH dlroW" where each word is reversed but the word order remains the same. Syntax Using LINQ with Split(), Select(), and Reverse() methods − string result = string.Join(" ", str.Split(' ').Select(word => new string(word.Reverse().ToArray()))); Using a traditional loop approach − string[] words = str.Split(' '); for (int i = 0; i < words.Length; i++) { words[i] = ReverseWord(words[i]); } string result = string.Join(" ...
Read MoreWhat are the difference between Composition and Aggregation in C#?
Composition and Aggregation are two important types of associations in C# that represent different levels of dependency between classes. Understanding these relationships helps design better object-oriented systems with proper coupling and lifecycle management. Composition Composition represents a strong "part-of" relationship where the child object cannot exist independently of the parent object. When the parent is destroyed, all child objects are also destroyed automatically. Composition: Strong Ownership Car (Owner) Engine (Owned) ...
Read MoreHow to join two lists in C#?
To join two lists in C#, you can use several methods. The most common approaches are using the AddRange() method to modify an existing list, or using LINQ's Concat() method to create a new combined list without modifying the originals. Syntax Using AddRange() to modify the first list − list1.AddRange(list2); Using LINQ Concat() to create a new list − var combinedList = list1.Concat(list2).ToList(); Using AddRange() Method The AddRange() method adds all elements from the second list to the end of the first list, modifying the original list − ...
Read MoreC# program to get the file name in C#
In C#, you can extract the file name from a full path using the Path.GetFileName() method from the System.IO namespace. This method returns only the file name and extension, without the directory path. Syntax Following is the syntax for using Path.GetFileName() method − string fileName = Path.GetFileName(filePath); Parameters filePath − A string containing the full path to the file. Return Value The method returns a string containing the file name and extension. If the path ends with a directory separator, it returns an empty string. Using ...
Read MoreC# Linq ElementAt Method
The ElementAt() method in C# LINQ returns the element at a specified index position in a sequence. It is part of the LINQ extension methods and can be used with any IEnumerable collection. The ElementAt() method throws an ArgumentOutOfRangeException if the index is out of bounds. For safer access, you can use ElementAtOrDefault(), which returns the default value for the type if the index is invalid. Syntax Following is the syntax for the ElementAt() method − public static TSource ElementAt(this IEnumerable source, int index) Following is the syntax for the ElementAtOrDefault() method − ...
Read More