PC Review


Reply
Thread Tools Rate Thread

convert a char[] to an object[] and back

 
 
Tom
Guest
Posts: n/a
 
      29th Jul 2004
I am trying to write a routine to do a generic operation on an array
dostuff(object []). But I have come across a problem. If I use a value
type array I cannot cast it to an object[]. Is there some way of doing
this? I guess you would have to box all the values in the array
individually seems like this could become expensive

Tom
 
Reply With Quote
 
 
 
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      29th Jul 2004
Tom <(E-Mail Removed)> wrote:
> I am trying to write a routine to do a generic operation on an array
> dostuff(object []). But I have come across a problem. If I use a value
> type array I cannot cast it to an object[]. Is there some way of doing
> this? I guess you would have to box all the values in the array
> individually seems like this could become expensive


Yes, that would be quite painful, but it's the only way of working if
you really need to pass it as object[]. Could you pass it as Array
instead, perhaps?

--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to convert object[] to char[] ? tienlx Microsoft C# .NET 5 27th Jan 2006 02:00 AM
how to convert managed char array to unmanaged char*? joye Microsoft VC .NET 1 16th Aug 2005 09:48 PM
How to convert managed char array to unmanaged char*? joye Microsoft VC .NET 0 10th Aug 2005 03:58 AM
How to convert managed char array to unmanaged char*? joye Microsoft VC .NET 5 2nd Aug 2005 11:02 PM
Re: Convert char array to char* in managed C++ Carl Daniel [VC++ MVP] Microsoft VC .NET 3 3rd Sep 2003 09:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:40 AM.