See how to pass strings as streams and design your .NET methods with timeout parameters in Stephen Toub's MSDN Magazine column.
.NET Matters: StringStream, Methods with Timeouts
.NET Matters: StringStream, Methods with Timeouts