About 50 results
Open links in new tab
  1. c# - Array containing Methods - Stack Overflow

    Oct 10, 2011 · I was wondering if you can create an Array or a List<> that contains methods. I don't want to use a switch or lots of if statements. Thanks

  2. c# extension methods for generic array - Stack Overflow

    Jun 21, 2022 · I'm trying to make extension methods for generic array, so I could takeout random set of elements. I made following extension methods for List<T> type and they work great, but I can't …

  3. c# - All possible array initialization syntaxes - Stack Overflow

    What are all the array initialization syntaxes that are possible with C#?

  4. Array slices in C# - Stack Overflow

    Jan 2, 2009 · How do you do it? Given a byte array: byte[] foo = new byte[4096]; How would I get the first x bytes of the array as a separate array? (Specifically, I need it as an IEnumerable<byte>) …

  5. Best way to "push" into C# array - Stack Overflow

    Jul 25, 2018 · When you allocate an array, the space for every array element is allocated (and, in C# those elements are initialized to the default value of the type, null for reference types).

  6. Returning array from methods C# - Stack Overflow

    Feb 20, 2022 · For the first question - array is a reference type and so when the function Test0 is called it calls a copy constructor of the array's reference so basically you assign the modified array to local …

  7. c# - How to pass an array between methods? - Stack Overflow

    Mar 5, 2020 · Here I'm running into a problem with properly returning and passing an array between methods. Something goes wrong with returning the array, especially from the second method, and …

  8. Store methods in an array and call them in C# - Stack Overflow

    Feb 10, 2017 · Because each delegate is its own type you cannot mix-and-match different delegate types in an array type to a single delegate-type, you can use the parent System.Delegate to allow …

  9. .net - Is it possible to extend arrays in C#? - Stack Overflow

    Jul 25, 2009 · I'm used to add methods to external classes like IEnumerable. But can we extend Arrays in C#? I am planning to add a method to arrays that converts it to a IEnumerable even if it is …

  10. c# method with unlimited params or method with an array or list?

    Jan 22, 2020 · SomeMethod(params int[] numbers); but my question is, what's the difference between that and just creating a method that receives a list or an array?