本文介绍了清除错误.不包含适用于入口点的静态"Main"方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
public static byte[] ReadFile(string filePath) { byte[] buffer; FileStream fileStream = new FileStream(@"c:\as.txt", FileMode.Open, FileAccess.Read); try { int length = (int)fileStream.Length; // get file length buffer = new byte[length]; // create buffer int count; // actual number of bytes read int sum = 0; // total number of bytes read // read until Read method returns 0 (end of the stream has been reached) while ((count = fileStream.Read(buffer, sum, length - sum)) > 0) sum += count; // sum is a buffer offset for next reading } finally { fileStream.Close(); } return buffer; }
推荐答案
Main 是C#应用程序的入口点,例如,请参见此处 "C#中的程序入口点" [ ^ ]. Main is the entry-point for a C# application, see, for instance, here "Program Entry point in C#"[^].
编写一个主方法并从中调用函数.我认为您已删除它 Write a main method and call you function from it. I think you have deleted it
更多推荐
清除错误.不包含适用于入口点的静态"Main"方法
发布评论