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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:17:08+00:00 2026-05-24T06:17:08+00:00

I declared a method of in C# like this: [OperationContract] [FaultContract(typeof(MyException))] MyClass MyMethod(… some

  • 0

I declared a method of in C# like this:

[OperationContract]
[FaultContract(typeof(MyException))]
MyClass MyMethod(... some params ..., Int32[] myParam);

And in C++/CLI a need to write the method matching the interface:

MyClass^ MyMethod(... some params ..., array<long>^ myParam) { ...

I need to trasfer array of longs for C++ world from .Net. I know that C++ long is not the .Net long. But I don’t know how to make this.

  • 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-24T06:17:09+00:00Added an answer on May 24, 2026 at 6:17 am

    In the C++ compiler for MSVC, long and int have the same size. I’m not sure if you’re thinking of long long which represents a 64-bit signed integer in MSVC. If you mean just long though, then Int32 within .Net should be fine.

    To be really safe, you can use the provided macros for signed 32-bit integers:

    #include <cstdint>
    
    MyClass^ MyMethod(... params ..., array<int32_t>^ myParam) { ...
    

    Or better yet, using the .NET defined types as Alexandre C recommends:

    MyClass^ MyMethod(... params ..., array<System::Int32>^ myParam) { ...
    

    The most important thing to take note of is that int, long, int32_t, and System::Int32 are all the same exact size in the current MSVC C++ compiler. It doesn’t matter which you use, but int32_t and System::Int32 are the safest choices.

    Microsoft can change their long at a later date to be a size larger 32-bits. If that were to happen, then you could recompile this same code with the new compiler with zero issues.

    With regards to what size each data type is, the standard requires that int and long are at least 4 bytes large. On some compilers, you may find that sizeof(long) != sizeof(int). For that reason, if you want to make sure that you’re using integers that are exactly 4 bytes big you should use the provided headers that guarantee the required size.

    For more details see here: http://en.wikipedia.org/wiki/Long_integer. The article includes the relevant links to the standards.

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

Sidebar

Related Questions

I have a RESTful WCF service with a method declared like this: [OperationContract(Name =
In ruby you can do something like this: def method(a, b) ... end myMethod(*myArray)
If I have a method declared like this: private void someFunction(object[] param1) When I
I have a generic type that is parameterized on some Enum, declared like this:
I have declared the PreApplicationStartMethodAttribute on the assembly level like this: [assembly: PreApplicationStartMethod(typeof(MyApp.Global), InitializeApplication)]
I have a method that was declared like this: public ButtonObject CreateStandardButton(type1 arg1, type2
Example: The -save: method of NSManagedObjectContext is declared like this: - (BOOL)save:(NSError **)error Since
I'm trying to declare a method in main.h like this: void buildGraph(int gNum, Graph**
How can I declare a method with keyword arguments just like rails do. some
Assume I declared an Array isFind[] like this, bool[] isFind = new bool[5]; for

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.