Should API.NET documentation define / set the literal (numeric) value of enumeration elements?

As a software developer, I want to provide the API documentation that I have done (provided as part of the product) so that my clients can use the API effectively without having to call me late at night.

This API is provided in various forms, including the .NET assembly. The .NET assembly includes enumerations for exits (in particular, return codes). I see a previous discussion about the merits of this approach: Should the enumeration be never used in the API? ... so I will continue.

For example, a server request will receive a result that is just a number, and in the .NET API this will be returned as an enumerated result - something like this:

public enum ApiResult {
  /// <summary>
  /// Success
  /// </summary>
  Ok,
  /// <summary>
  /// Input parameter was incorrect
  /// </summary>
  InvalidParameter,
  /// <summary>
  /// The method failed
  /// </summary>
  OperationFailed
}

: .NET API ?... (, , )?

, - , #, . - ?

, , API, OLE/COM, , .

+4
2

, #. @Alexei.

, , #. ( , ). (TCP? IP-?). , Wireshark, , .

, , , .NET.

+1

#, .

, C/++ #

default... int... , sbyte, short, ushort, int, uint, long ulong.

, ( , ):

  • enum - , - , , .
  • API ,
  • , ( API , ).

, API - .

. : " API.NET ?" , # .

+2

Source: https://habr.com/ru/post/1534355/


All Articles