简体   繁体   中英

When are ParameterInfo.IsLcid or ParameterInfo.IsRetval true?

I find this question in Stack Overflow when googleing, but it has been deleted. So I list this question again.

As I can't find the LcidAttribute or RetvalAttribute in BCL, I guess C# hasn't provided the support for locale identifier parameter and return value parameter.

Is that it?

Thanks all.

They are associated with the ParameterAttributes enumeration . Which is used in metadata for the parameter of a method, only a compiler can emit the [modopt].

I do not know of a compiler that actually does this. I have a decent guess at the background though, these attributes are also used in IDL. Which is an interface description language that is used in COM and RPC. Having this option ensures that .NET metadata can also describe the kind of declarations that are written in IDL and can appear in type libraries.

The [lcid] attribute is described here . It doesn't actually describe usage and I've never used it myself. No real idea why you'd use it.

The [retval] attribute is described here . Very important in COM automation method declarations, it marks the parameter that returns the method value. And used by a tool like Tlbimp.exe, it rewrites the method to make that parameter the return value type.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM