What is the memset function in C#

  • Thread starter Thread starter James Dean
  • Start date Start date
J

James Dean

What i want to do is the following:
I want to first of all copy one value from another array into my current
array.....then i want to copy this same value a specified number of
times. The Buffer class only lets me copy one value to one place in my
current array. I dont want to use a big awkward "For loop" to set all
the values in my array.So here i will put it in steps what i want to do.
1. I have my main array
2. I have my current array.
3. I want to copy one value from the main array n(e.g. 10)....number of
times to my current array.

memset function does this in earlier visual studio....what does this in
C#.





*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
James,

You can write a little helper routine containing the loop, and call this
helper from your main code. This way, the code won't look awkward.

P.S. Well, the Buffer class might actually have had a some kind of Fill
method. I don't know why Microsoft has limited it to only copying bytes -
probably because direct memory access is not favored in managed programming
and it might degrade the performance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top