Hi Gendarmes,

I'm wondering if DisposableFieldsShouldBeDisposedRule should be
smarter and detect this case too (saying that class A should be
IDisposable):

        interface ISomeInterface
        {
                string Name { get;  }
        }

        class A
        {
                private ISomeInterface someMember;

                public ISomeInterface SomeMember {
                        get {
                                if (someMember == null)
                                        someMember = new B();
                                return someMember;
                        }
                }
        }

        class B : ISomeInterface, IDisposable
        {
                private FileStream stream;

                public string Name { get { return "test"; } }
                public B () {
                        stream = new FileStream("whatever", FileMode.Append);
                }

                public void Dispose()
                {
                        if (stream != null)
                                stream.Dispose();
                }
        }

Cheers,

  Andres

-- 
You received this message because you are subscribed to the Google Groups 
"Gendarme" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/gendarme?hl=en.

Reply via email to