Is it a good practice to return a byte[] in a WCF service which will be invoked by many applications
below is the code
public byte[] GetDoc(string docParam)
{
byte[] doc;
doc = GenerateDoc(docParam);
}
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s good practice to factor common code into a convenient method so that many callers could call this convenient method. This is regardless of return type. If the callers would need to manipulate the
byte[], then this can become convenient and eliminate redundant code.By the way, regarding the code that you posted, is that real code or just an example? If it’s real code:
byte[].return doc;as the last line, why haveGenerateDoc()insideGetDoc()?GetDoc()doesn’t really provide any true benefit.