IT Community - Software Programming, Web Development and Technical Support

Convert int[] into byte[] using C#

This is a discussion on Convert int[] into byte[] using C# within the C# Programming forums, part of the Software Development category; How to convert int[] into byte[] using C#?...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C# Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 07-25-2007, 05:41 AM
bluesky bluesky is offline
D-Web Analyst
 
Join Date: Jun 2007
Posts: 201
bluesky is on a distinguished road
Question Convert int[] into byte[] using C#

How to convert int[] into byte[] using C#?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-25-2007, 05:57 AM
kingmaker kingmaker is offline
D-Web Genius
 
Join Date: Jun 2007
Posts: 882
kingmaker is on a distinguished road
Send a message via Yahoo to kingmaker
Default Re: How to convert int[] into byte[] using C#?

Hi bluesky...

The value of integer value can be converted into byte using the commment Convert.ToByte (int value), then converted byte value is stored in Byte array.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-23-2007, 01:18 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 1,061
S.Vinothkumar is on a distinguished road
Wink Re: How to convert int[] into byte[] using C#?

Hi Friend,

try this way



Code:
Byte[] byteArr = new byte[] {1,2,3,4,5}; 
int[] intArr = new int[5]; 

for(int i=0; i< byteArr.Length; i++) { 
intArr [i] = Convert.ToInt16(byteArr[i].ToString()); 
} 
foreach(int c in intArr) 
{ 
Response.Write(c); 
}
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert YUV to RGB kingmaker C# Programming 2 02-17-2008 12:07 AM
How to convert C source to C# ? oxygen C# Programming 1 07-30-2007 04:34 AM
How many bit combinations are there in a byte? vadivelanvaidyanathan C and C++ Programming 1 07-17-2007 02:56 AM
Convert XML to JSON in PHP ramkumaraol PHP Programming 0 07-17-2007 12:10 AM
File convert varghese PHP Programming 0 07-11-2007 04:11 AM


All times are GMT -7. The time now is 11:21 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0