Sabid Ansari

Sabid Ansari

150 Articles Published

Articles by Sabid Ansari

150 articles

C# Program to Read a String and Find the Sum of all Digits

Sabid Ansari
Sabid Ansari
Updated on 17-Mar-2026 1K+ Views

C# is a popular object-oriented programming language used to develop Windows applications, web applications, and games. In this article, we will discuss how to write a C# program to read a string and find the sum of all digits present in the string. Approach To find the sum of digits in a string, we need to iterate through each character, check if it's a digit using char.IsDigit(), and convert it to an integer to add to our running sum. Using char.IsDigit() Method The char.IsDigit() method determines whether a character represents a decimal digit. Here's the complete ...

Read More

C# Program to Reverse the List of Cities using LINQ

Sabid Ansari
Sabid Ansari
Updated on 17-Mar-2026 346 Views

In C#, LINQ (Language Integrated Query) is a powerful feature that allows us to perform queries on various data sources, including arrays, lists, and databases. It provides an efficient and concise way to manipulate data and has become an essential tool for developers. In this article, we will explore how to use LINQ to reverse a list of cities in C#. LINQ is a set of extensions to the .NET Framework that provides a standard way to query data from different data sources using a common syntax. It allows developers to write queries that resemble SQL statements, making it ...

Read More

C# Program to Search Sub-Directory in a Given Directory

Sabid Ansari
Sabid Ansari
Updated on 17-Mar-2026 636 Views

Searching for sub-directories in a given directory is a common task in many applications. In C#, we can use the Directory and DirectoryInfo classes provided by the System.IO namespace to perform this task. In this article, we will explore how to write a C# program to search for sub-directories in a given directory. Syntax Following is the syntax for using DirectoryInfo.GetDirectories() method − DirectoryInfo directoryInfo = new DirectoryInfo(path); DirectoryInfo[] subdirectories = directoryInfo.GetDirectories(); Following is the syntax for using Directory.GetDirectories() method − string[] subdirectories = Directory.GetDirectories(path); Using DirectoryInfo.GetDirectories() The DirectoryInfo.GetDirectories() ...

Read More

C# Program to Show the Use of Exists Property

Sabid Ansari
Sabid Ansari
Updated on 17-Mar-2026 2K+ Views

The Exists method in C# is a useful method that checks whether any element in a List matches a given condition. This method takes a predicate as an argument and returns a bool value indicating whether any element exists in the list that satisfies the specified condition. Syntax Following is the syntax for the Exists method − public bool Exists(Predicate match) Parameters match − A Predicate delegate that defines the conditions of the elements to search for. Return Value Returns true if at least one element matches the specified ...

Read More

C# Program to Show the Use of GetEnvironmentVariable() Method of Environment Class

Sabid Ansari
Sabid Ansari
Updated on 17-Mar-2026 8K+ Views

The GetEnvironmentVariable() method of the Environment class in C# is used to retrieve the value of an environment variable. This method is essential for accessing system-wide and user-specific environment variables such as PATH, TEMP, or custom variables set by applications. Syntax Following is the basic syntax for the GetEnvironmentVariable() method − public static string GetEnvironmentVariable(string variable) There is also an overloaded version that accepts an EnvironmentVariableTarget parameter − public static string GetEnvironmentVariable(string variable, EnvironmentVariableTarget target) Parameters variable − A string containing the name of the environment variable. target ...

Read More

C# Program to Sort a List of Employees Based on Salary using LINQ

Sabid Ansari
Sabid Ansari
Updated on 17-Mar-2026 1K+ Views

In many software development projects, there comes a point where it becomes necessary to sort a list of objects based on one or more properties of the objects. In C#, the LINQ (Language Integrated Query) library provides a powerful and easy-to-use way to sort lists of objects based on one or more criteria. In this tutorial, we will demonstrate how to sort a list of Employee objects based on their salary using LINQ. Syntax Following is the syntax for sorting a list using LINQ OrderBy methods − // Sort in ascending order var sortedList = list.OrderBy(item ...

Read More

C# Program to Sort a List of String Names Using the LINQ OrderBy() Method

Sabid Ansari
Sabid Ansari
Updated on 17-Mar-2026 3K+ Views

Sorting a list of string names is a common task in programming, and the LINQ OrderBy() method in C# provides an elegant and efficient way to accomplish this. In this article, we will explore how to sort string lists using LINQ, including both ascending and descending order sorting. What is LINQ OrderBy() Method? The LINQ OrderBy() method is used to sort elements of a sequence in ascending order based on a specified key. For descending order, you use OrderByDescending(). These methods work with any IEnumerable collection and return an IOrderedEnumerable. Syntax Following is the syntax for ...

Read More

Difference Between Golang and PHP

Sabid Ansari
Sabid Ansari
Updated on 15-Mar-2026 3K+ Views

Both Golang and PHP are popular programming languages used for web development. Although both languages are suitable for building web applications, they have significant differences in terms of their syntax, performance, and popularity. In this article, we will discuss the key differences between Golang and PHP in detail and compare them in a tabular form. Golang vs PHP Here are the main differences between Golang and PHP − Category Golang PHP Syntax Golang has a strict syntax with mandatory semicolons and braces PHP has a flexible syntax with optional semicolons and braces ...

Read More

How to Use Go With MongoDB?

Sabid Ansari
Sabid Ansari
Updated on 15-Mar-2026 592 Views

MongoDB is a popular NoSQL database that is widely used in modern web applications. Go, on the other hand, is a fast and efficient programming language that is becoming increasingly popular for building web applications. In this article, we will discuss how to use Go with MongoDB, including how to connect to a MongoDB database and how to perform basic CRUD operations. Installing the MongoDB Driver for Go Before we can start using Go with MongoDB, we need to install the MongoDB driver for Go. The easiest way to do this is by using the following command ? ...

Read More

Task Hijacking in Android

Sabid Ansari
Sabid Ansari
Updated on 19-Jun-2023 806 Views

Introduction In the world of cybersecurity, task hijacking in Android represents a crucial issue for developers, users, and security professionals. This term refers to a technique used by malicious actors to manipulate or take over tasks in Android, leading to significant vulnerabilities. This article aims to provide an in-depth understanding of Android task hijacking, its impact, and preventative measures. What is Task Hijacking in Android? Task hijacking in Android is a security flaw that allows malicious applications to take control of genuine app tasks. Essentially, a hacker can exploit this vulnerability to manipulate the user interface (UI) of an app, ...

Read More
Showing 1–10 of 150 articles
« Prev 1 2 3 4 5 15 Next »
Advertisements