C# problem

  • Thread starter Thread starter kaveh rahimi123456789
  • Start date Start date
K

kaveh rahimi123456789

Guest
I've written a code and I receive error CS1520 Method must have a return type

My copde is

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;


namespace WpfApplication1
{

/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public ReadPolling()
{

var reader = MyUsbDevice.OpenEndpointReader(ReadEndpointID.Ep01);


byte[] readBuffer = new byte[1024];
while (ec == ErrorCode.Success)
{
int bytesRead;

// If the device hasn't sent data in the last 5 seconds,
// a timeout error (ec = IoTimedOut) will occur.
ec = reader.Read(readBuffer, 5000, out bytesRead);

if (bytesRead == 0) throw new Exception(string.Format("{0}:No more bytes!", ec));
Console.WriteLine("{0} bytes read", bytesRead);

// Write that output to the console.
Console.Write(Encoding.Default.GetString(readBuffer, 0, bytesRead));
return bytesRead;
}
Console.WriteLine("\r\nDone!\r\n");

}

}
}

Continue reading...
 

Similar threads

Back
Top