473,801 Members | 2,309 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trouble converting arraylist of bytes to a byte array

i cannot convert my arraylist of bytes to a byte array what could be the
problem.
i tried the following but it did not work:
byte[] bytearray =
(byte[])tempbitarray.T oArray(tempbita rray[0].GetType());

Also i was wondering is it possible to convert a bitarray to a
bytearray.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
1 9948
Hi James,
i cannot convert my arraylist of bytes to a byte array what could be the
problem.
i tried the following but it did not work:
byte[] bytearray =
(byte[])tempbitarray.T oArray(tempbita rray[0].GetType());

Also i was wondering is it possible to convert a bitarray to a
bytearray.


Use CopyTo(...) method of ArrayList, it works on 100%!

Cheers!

Marcin
Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2288
by: Luk Vloemans | last post by:
Hey, I'm currently working on a project to get GPS-data onto a PDA. At this stage, I'm already getting data from the device, but my problem is: It's rubbish. At least, it looks as if it were rubbish. example: "`?~?\0?~?~????\0x?x?x?x?x?x~??x?x?xx?\0x?x?" I found patterns in the code I received, so it's just encoded.
4
3908
by: Svetoslav Vasilev | last post by:
Hi, I experience some troubles trying to convert an object,returned by a DataTable for a field value to its actual representation of Byte. The field values in a DataTable as we all know are returned as instance of the Object class and it is up to the developer to cast it to its actual type. In my case i access a field of type text in the database and obviously the driver converts it into byte array. Unfortunaletly a construct like this Array...
3
1739
by: Max Gattringer | last post by:
I have written a little programm, which converts normal Text into Unicode Bytes - nothing special, but i tried to creat 2nd Encoder which converts strings(numbers) in a textBox (strings which i had converted from UnicodeString to Bytes) to a UnicodeString. <textbox Text : 0770> ->>> byte <--- I want the numbers in the Array ---->>>> as UnicodeString: M Thx PS: Please ignore the broken English - It's hard to discribe my problem..
2
1255
by: crater | last post by:
I need to convert a String to a Byte array and vice versa. Can someone nudge me in the right direction please?
2
10364
by: Shreddy | last post by:
Hi, I'm trying (or struggling) to convert some C code to C#. The existing C client is sending a structure via a TCP socket to a network server. The structure contains a mix of int and char data types . I can re-create the structure in c# with LayoutKind.Explicit, but how do I convert this structure to a byte array for use with the Socket.Send() method?
8
9306
by: tbh | last post by:
for historical reasons i need to be able to call, from C# under DotNet 2, as COM+ DLL function that returns a "string" which is really an array of seemingly arbitrary bytes (presumably non-zero). however, C# treats this as a string and the only ways i have found to convert it to a byte array lose data (apparently in those cases when the "characters" are not legal UTF values). in this case (a program i only need to run once) i would be...
2
2688
by: Bjorn Sagbakken | last post by:
Hi. This story is about uploading jpg's, then resize them to fixed width or height and storing them to an SQL table. The only way I have found so far is to read the uploaded file to an image-variable, then using the method of creating thumbnails for the resizing. Next, I write this to a temp file on the disk, and read the file back to a byte array in order to insert/update the SQL table. Now, this works well, and even fast enough, no...
0
9698
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10292
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10262
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10052
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7589
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6829
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5479
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5616
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4156
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.