简体   繁体   中英

Visual Studio Modeling and covariance in generic arguments

I'm using Visual Studio Modeling project and code generation with partial clases. Some interfaces have generic parameters and generic constraints for these parameters. I'm using Template Parameters to specify the parameters, their types and their constraints. All code is generated successfully so far.

Now, i want to add a variance and covariance in these generic parameters. Here is the problem:

How i can specify the "in" or "out" tag in generic parameters?

Edit: In addition, i want put generic arguments in Methods too, but Template Parameters not found in method properties toolbox. It's possible specify generic parameters to methods too?

This is pretty generic:

public interface IFoo<in T, out TResponse>
{
    TResponse DoSomething(T entity);
}

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