2012-03-12 1 views
0

xmldocを使用して、汎用のActionまたはFuncの戻り値の型を持つメソッドまたはプロパティをどのように文書化しますか? 例:メソッドまたはプロパティの型パラメータを汎用型の戻り値の型で文書化する方法ActionまたはFunc

/// <summary> 
/// Gets or sets the print method. Parameters: file, printer name??? 
/// </summary> 
/// <value> 
/// The print method. 
/// </value> 
public Action<string, string> PrintMethod { get; set; } 

この場合のベストプラクティスはどれですか。

答えて

0

このアクションのパラメータを文書化する必要がある場合は、Action<string, string>を使用しないでください。代わりにカスタムデリゲートを作成し、デリゲートのパラメータを記録してください。

/// <summary> 
/// Gets or sets the print method. 
/// </summary> 
/// <value> 
/// The print method. 
/// </value> 
public FilePrintAction PrintMethod { get; set; } 

/// <summary> 
/// Represents a method for printing a file to a printer 
/// </summary> 
/// <parameter name="file">Path of the file to print</parameter> 
/// <parameter name="printerName">Name of the printer</parameter> 
public delegate void FilePrintAction(string file, string printerName); 
+0

これは良いアドバイスです!しかし、問題は、プロパティまたはメソッドの戻り値の型としてActionまたはFuncを使用するかどうかではなく、それを文書化する方法です。 –

+0

@Shurup、私のポイントは、アクションやFuncのパラメータを文書化する「クリーンな」方法がないことです。それを行う必要がある場合は、パラメータを記録できる特定のデリゲートを作成します。 –

関連する問題