Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 878059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:42:43+00:00 2026-05-15T11:42:43+00:00

I tried to use the List.ConvertAll method and failed. What I am trying to

  • 0

I tried to use the List.ConvertAll method and failed. What I am trying to do is convert a List<Int32> to byte[]

I copped out and went this route, but I need to figure out the ConvertAll method…

List<Int32> integers...

internal byte[] GetBytes()
{
    List<byte> bytes = new List<byte>(integers.Count * sizeof(byte));
    foreach (Int32 integer in integers)
        bytes.AddRange(BitConverter.GetBytes(integer));

    return bytes.ToArray();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T11:42:44+00:00Added an answer on May 15, 2026 at 11:42 am

    Since you don’t want a byte[][] where each integer maps to an array of four bytes, you cannot call ConvertAll. (ConvertAll cannot perform a one-to-many conversion)

    Instead, you need to call the LINQ SelectMany method to flatten each byte array from GetBytes into a single byte[]:

    integers.SelectMany(BitConverter.GetBytes).ToArray()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I cant figure this one out... I have tried to use FluentNhibernate with SQLCE4..
I tried to use OPTION (MAXRECURSION 0) in a view to generate a list
I tried to use this on my class library mylib.core.data.dll and got a successful
I tried to use this: private void CreateDevice() { _playbackDevice = new WaveOut(); _playbackDevice.PlaybackStopped
Yesterday i tried to use std::unordered_map and this code confused me how much memory
I'm trying to use a Class (adns-python) which is expecting a list in the
I have tried to use C++0x initializer list as argument to a constructor call
I need to use a list of int[2] . I tried using the list
I tried to use ordered list <ol> and each list item <li> outputs as
I have 2 questions. First, is this possible to use List item in sencha

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.