How can you use optional parameters in C#?

前端 未结 23 2546
逝去的感伤
逝去的感伤 2020-11-22 17:02

Note: This question was asked at a time when C# did not yet support optional parameters (i.e. before C# 4).

We\'re building a web API tha

23条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-22 17:55

    Instead of default parameters, why not just construct a dictionary class from the querystring passed .. an implementation that is almost identical to the way asp.net forms work with querystrings.

    i.e. Request.QueryString["a"]

    This will decouple the leaf class from the factory / boilerplate code.


    You also might want to check out Web Services with ASP.NET. Web services are a web api generated automatically via attributes on C# classes.

提交回复
热议问题