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

  • SEARCH
  • Home
  • 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 189959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:12:57+00:00 2026-05-11T16:12:57+00:00

How to redo the declaration of that C++ template function in C#? template <class

  • 0

How to redo the declaration of that C++ template function in C#?

    template <class type>
void ReadArray(type * array, unsigned short count)
{
    int s = sizeof(type) * count;
    if(index + s > size)
        throw(std::exception("Error 102"));
    memcpy(array, stream + index, s);
    index += s;
}   

When called,it append bytes/word/(type) in the given array by reading a stream(stream) at a specific position(index).

I tried to redo the declaration like this,but i get an error

    public static T void ReadArray(<T> Array inputarray) // error
    {
        ...
    }

Thanks!

Another conservative question – how to append the bytes into that array(memcpy()),should i use a pointer?

  • 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-11T16:12:57+00:00Added an answer on May 11, 2026 at 4:12 pm

    You use it like this:

    public static void ReadArray<T>(T[] inputArray) {
       ...
    }
    

    You can use the Array.Copy method to copy data between arrays.

    Edit:
    If you want to make a “blind copy” of data between different data types, e.g. byte array to long array, that’s not something that you can do using safe code. You can use the BitConverter class for example to convert eight bytes from an array into a long. You could also use unsafe code with pointers to do the “blind copy”, but you should save that until you actually run into performance problems using safe methods.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We need to redo a database in MySQL that has been already done on
This answer says: Vim's undo/redo system is unbeatable. Type something, undo, type something else,
I have a website that I made and I am planning to redo it.
I'm trying to redo this in jQuery: <script language=JavaScript type=text/javascript> var thisIsSelected = '<?php
I'm trying to implement an Undo/Redo stack in a C# application that I'm working
I am trying to make a loop to redo a Matlab function 1000 times.
I'm trying to redo a webapp that was designed some 3 years ago. It
$(document).ready(function() { redo(1); $(select).change(function () { var str = ; $(select option:selected).each(function () {
i've been unsuccessfully attempting to create my own undo/redo classes that work well with
I've implemented an undo /redo framework and have a set of command classes that

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.