WiresharkFile abstract
class:
public abstract class WiresharkFile
{
private PlayBehavior _playBehavior;
public void Transmit()
{
_playBehavior.Transmit();
}
public virtual void Dispose()
{
// Implemented inside inherit classes.
}
}
Play options abstract
class:
public abstract class PlayBehavior
{
public WiresharkFile wiresharkFile;
public abstract void Transmit();
}
Play options son class:
public class Normal : PlayBehavior
{
public override void Transmit()
{
using (this.wiresharkFile)
{
}
}
}
So i have this derived class:
public class Libpcap : WiresharkFile, IDisposable, IEnumerable<Packet>
{
private BinaryReader binaryReader;
public void Dispose()
{
if (binaryReader != null)
binaryReader.Close();
}
...
// Severl methods
...
public override void SendPackets()
{
base.Transmit();
}
}
My question:
Inside this Libpcap
class when call base.Transmit()
: where to use the using ?
Inside this Libpcap
class SendPackets():
public override void SendPackets()
{
using(this)
{
base.Transmit();
}
}
Or inside Normal
class Transmit()
:
public class Normal : PlayBehavior
{
public override void Transmit()
{
using (this.wiresharkFile)
{
}
}
}