Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to comment code using a generic class of a specific type

I'm trying to document my code in a proper way.

I have a method that can throw a FaultException of a specific type. When I view the documentation for the method it doesn't show the specific type of the FaultException.

///<summary>
/// Description of method
///</summary>
/// <exception cref="FaultException{ValidationFault}">Description here</exception>
OrganizationDto Update(UpdateOrganizationRequest organizationDto);

Documentation shows: FaultException<TDetail>: Description here

I want it to show: FaultException<ValidationFault>:Description here

How can I achieve this?

like image 203
ds99jove Avatar asked Mar 06 '15 09:03

ds99jove


People also ask

How to write a generic class in Java?

Here are some noteworthy points with regards to writing generic classes in Java: T is just a name for a type parameter, like a variable name. That means you can use any name you like for the type parameter. However, there are some conventions for naming type parameters in Java: T for type; E for element; K for key; V for value, etc.

How can I refer to generic types and methods in doc comments?

The compiler team decided to improve this by allowing an alternate syntax to refer to generic types and methods in doc comments. Specifically, instead of using the open and close angle-brackets it’s legal to use the open and close curly braces. The example above would then become:

How to prevent generic classes from being used with reference types?

For example, if you know that your generic class is intended for use only with reference types, apply the class constraint. That will prevent unintended use of your class with value types, and will enable you to use the as operator on T, and check for null values. Whether to factor generic behavior into base classes and subclasses.

What is generics in C++?

Generics also provide compile-time type safety which allows programmers to catch invalid types at compile time. Generic means parameterized types. Using generics, the idea is to allow any data type to be it Integer, String, or any user-defined Datatype and it is possible to create classes that work with different data types.


1 Answers

I'm working on ReSharper version 8.2.2 and I can see the exception documentation like you wanted.

See screenshot:

Exception Description on ReSharper 8.2.2

On which version are you working on? maybe it is a defect related to this version?

like image 65
DeJaVo Avatar answered Nov 07 '22 09:11

DeJaVo