About 7,190,000 results
Open links in new tab
  1. c# - What is the best way to find all combinations of items in an array

    Dec 23, 2009 · I created a method to get the unique combination of all the integer elements in an array as shown below. I've used Tuple to represent a pair or combination of numbers:

  2. c# - Getting all the combinations in an array - Stack Overflow

    Nov 22, 2013 · var combinations = new List<string>(); for (int i = startIndex; i < initialArray.Length; i++) var value = $"{pair}{initialArray[i]}"; combinations.Add(value); combinations.AddRange(CreateCombinations(i + 1, value, initialArray)); return combinations; The text variable will contain.

  3. Getting All Combinations Of An Array Of Elements - C# Corner

    In this blog, we will learn, how to get all the combination of the elements in an array.Suppose, we have an integer array "myarrint", as given below. int [] myarrint = new [] { 1, 2, 3 }; We need to get all the combination of elements in an array without repeating it.

  4. c# - How to get all possible combinations from an array ... - Stack ...

    Dec 31, 2015 · To get all possible output having all possible count of items from an IEnumerable<T> you can add this extension method: var result = new List<IEnumerable<T>>().AsEnumerable(); for (int i = 1; i <= source.Count(); i++) var intermediateResult = Enumerable.Range(1, i) .Select(x => source.AsEnumerable()).CartesianProduct();

  5. Build All Possible Combinations Of A List Of Values - C# Corner

    In this blog, I will demonstrate how to generate possible permutations and combinations using C# console application. Let's take an example of a product that has few options, like size, color, material used to make the product.

  6. Permutation and Combination Calculator in C#

    In this tutorial, we’ll learn how to Print all possible combinations of r elements in a given array of size n in C# Console Application. Permutations and combinations are part of a branch of mathematics called combinatorics, which involves studying finite, discrete structures.

  7. Generating Combinations of Arrays in C#: A Deep Dive - Try / …

    Mar 12, 2024 · To generate combinations of arrays in C#, we can use a recursive function. The basic idea is to choose an element from the first array, and then generate all possible combinations of the remaining elements.

  8. c# - Get all combinations of selecting k elements from an n-sized array

    May 23, 2018 · The goal was to find all possible combinations of choosing k elements from a n-sized array (basically the Binomial coefficient) and return them. Unlike this code - here I don't want all possible combinations, just those that are k in size.

  9. Finding All the Permutations of an Array in C# - Chad Golden

    Jun 21, 2019 · Given an array of integers, we need to find all the possible permuations. In this article I want to share my C# solution. Given an array of integers (they must each be unique), find the set of possible permutations. Our input is a simple array of unique integers. For this example we'll use [1,2,3].

  10. c# - Generating all Possible Combinations - Stack Overflow

    Given 2 arrays Array1 = {a,b,c...n} and Array2 = {10,20,15....x} how can I generate all possible combination as Strings a (i) b (j) c (k) n (p) where. Such as: ...... Similar to a Cartesian product, in which the second array defines the upper limit for each element in first array. Example with fixed numbers, Array x = [a,b,c] Array y = [3,2,4] .

  11. Some results have been removed
Refresh