FileStream fs = new FileStream("test.txt", FileMode.Open); byte[] buffer = new byte[1024]; int bytesRead = fs.Read(buffer, 0, buffer.Length);
WebRequest request = WebRequest.Create("http://www.example.com"); WebResponse response = request.GetResponse(); Stream stream = response.GetResponseStream();In this example, we are creating a web request to retrieve data from a URL and then getting the stream of data from the response. The package library for System GetStream is the .NET Framework library, which is a core library for Microsoft's .NET platform.