Stream reference error
Compiler Error Message: 'Stream' is an ambiguous reference between 'System.IO.Stream' and 'WebReference.Stream'
Any thoughts?
I have web开发者_如何学运维 method accepting System.IO.Stream
stream as an input parameter & internally i assing stream=new MemoryStream(bytes[]);
You probably have both System.IO
and WebReference
in your using
declarations of the file, so the compiler doesn't know which one you want to use.
You can fully qualify its use, remove an unused reference, or alias one of them in the using declaration.
at the top of the code file your using both System.IO
and WebReference
.
So when you use Stream
the compiler doesn't know what you are referring.
Just use the fully qualified name:
System.IO.Stream stream=new MemoryStream(bytes[]);
It looks like there is a class called Stream
in multiple namespaces.
Assuming both of your original using directives are required, you can resolve this in two ways:
Use the fully qualified name:
System.IO.Stream stream = new MemoryStream();
Add a alias directive at the top:
using
Stream = System.IO.MemoryStream;
精彩评论