Avatar of SunnyDark
SunnyDarkFlag for Israel

asked on 

How to apply MarshalAs Attribute to return value of a property in managed C++

Hi,
I can apply a MarshalAs attribute to a return value of a property like so:

public decimal Foo {    
 [return: MarshalAs(UnmanagedType.Currency)]    
get {        return this.foo;    }    
[param: MarshalAs(UnmanagedType.Currency)]    
set {        this.foo = value;    }
}
 
How would I do the same in managed C++?
property RetClass^ Foo{	
 RetClass^ get() {
  return gcnew RetClass(); 
 }
}

Open in new window

Visual C++.NETC#

Avatar of undefined
Last Comment
SunnyDark
ASKER CERTIFIED SOLUTION
Avatar of SunnyDark
SunnyDark
Flag of Israel image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
C#
C#

C# is an object-oriented programming language created in conjunction with Microsoft’s .NET framework. Compilation is usually done into the Microsoft Intermediate Language (MSIL), which is then JIT-compiled to native code (and cached) during execution in the Common Language Runtime (CLR).

98K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo