For me, the brackets almost get in the way in the second one.  I can
see how they could be used to clean it up, but there are so few
elements that it would be difficult to misunderstand the first.

On 5 Jan, 19:48, Glenn <[email protected]> wrote:
> Here's where you guys can voice your opinions...but at least back them up!
>
> I have a couple simple classes to input and output a string in the same
> format as MFC.  (Have to do it to be backward compatible with the existing
> MFC application.)  The base layout for the class is as follows:
>
> public class MFCStringReader : BinaryReader
> {
>   public MFCStringReader(Stream s) : base(s) {}
>
>   public String ReadCString()
>   {
>     <processing code here>
>   }
>
> There are many instances in which I only need to read one string.  How would
> you write it?
>
>   value = new MFCStringReader(sr).ReadCString();
>
> or
>
>   value = (new MFCStringReader(sr)).ReadCString();
>
> The first is a bit cleaner, but the second makes it clearer as to what is
> being returned.  Comments!
>
> ...Glenn

Reply via email to