开发者

How not to supply values to a webMethod

I'm working on implementing a webMethod for a w开发者_Python百科ebService which has the following header:

 public string addDocument(string docName, int docSize, string docType, string docDestinationPath, int newArch, string archName , int parentID, int archiveID )

When newArch == 0 -> no need to supply parentID value

but when newArch ==1 -> all the values should be supplied

I've tried to supply a default value when parentID isn't supplied

 public string addDocument(string docName, int docSize, string docType, string docDestinationPath, int newArch, string archName="" , int parentID=0, int archiveID=0)

but that didn't work !

What should I do to avoid this error

" Input string was not in a correct format."


Have two methods:

public string addDocumentNewArch(string docName, int docSize, string docType, string docDestinationPath, string archName , int parentID, int archiveID )

public string addDocumentOldArch(string docName, int docSize, string docType, string docDestinationPath, string archName , int archiveID )

This will make it very clear to the caller what they are doing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜