Documentation comments C# with Example



Documentation comments C# with Example

XML documentation comments can be used to provide API documentation that can be easily processed by tools: 
///  
/// A helper class for validating method arguments. 
///  
public static class Precondition 
{ 
///  
/// Throws an  with the parameter 
 

/// name set to paramName if value does not satisfy the 
/// predicate  specified. 
///  
///  
/// The type of the argument checked 
///  
///  
/// The argument to be checked 
///  
///  
/// The predicate the value is required to satisfy 
///  
///  
/// The parameter name to be passed to the 
/// . 
///  
/// The value specified 
public static T Satisfies(T value, Func predicate, string paramName) 
{ 
if (!predicate(value)) 
throw new ArgumentOutOfRangeException(paramName); 
return value; 
} 
} 
Documentation is instantly picked up by IntelliSense: 
 

0 Comment's

Comment Form