L
Lars Schouw
I am trying to port some code over from Java but are having problems.
In Java you can define code on the when you override and call it at the same place.
For example in Java you can do this:
public static Pipe newPipe(final InputStream in)
{
final CodedInput codedInput = new CodedInput(in, false);
return new Pipe()
{
protected Input begin(Pipe.Schema pipeSchema) throws IOException
{
return codedInput;
}
protected void end(Pipe.Schema pipeSchema, Input input,
boolean cleanupOnly) throws IOException
{
if(cleanupOnly)
return;
//assert input == codedInput;
}
};
}
where Pipe is defined as
public abstract class Pipe
{
protected abstract Input begin(Pipe.Schema pipeSchema) throws IOException;
protected abstract void end(Pipe.Schema pipeSchema, Input input,
boolean cleanupOnly) throws IOException;
}
How can I do this in C#?
Lars
In Java you can define code on the when you override and call it at the same place.
For example in Java you can do this:
public static Pipe newPipe(final InputStream in)
{
final CodedInput codedInput = new CodedInput(in, false);
return new Pipe()
{
protected Input begin(Pipe.Schema pipeSchema) throws IOException
{
return codedInput;
}
protected void end(Pipe.Schema pipeSchema, Input input,
boolean cleanupOnly) throws IOException
{
if(cleanupOnly)
return;
//assert input == codedInput;
}
};
}
where Pipe is defined as
public abstract class Pipe
{
protected abstract Input begin(Pipe.Schema pipeSchema) throws IOException;
protected abstract void end(Pipe.Schema pipeSchema, Input input,
boolean cleanupOnly) throws IOException;
}
How can I do this in C#?
Lars