C# using alias as type parameter in other using alias

前端 未结 5 1203
既然无缘
既然无缘 2021-01-13 01:33

I\'m trying to define a pair of type aliases at the top of my C# program. This is a short example of what I\'m trying to do:

using System;
using System.Colle         


        
5条回答
  •  醉梦人生
    2021-01-13 02:04

    (Adding this here because I ran across this question a lot when searching for a related issue, so it might help others)

    If you're looking to use aliases to functions for a functional style of programming, what you're looking for is the delegate keyword. You can think of delegate as making an interface, except it's for a function.

    so instead of using Expression = Func; using Converter = Func, Expression>; you do delegate string Expression(); delegate Expression Converter(List tokenizedExpressions);

    https://weblogs.asp.net/dixin/functional-csharp-function-type-and-delegate

提交回复
热议问题