清除错误.不包含适用于入口点的静态"Main"方法

编程入门 行业动态 更新时间:2024-10-28 03:27:26
本文介绍了清除错误.不包含适用于入口点的静态"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"方法

本文发布于:2023-11-15 12:37:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1594510.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:适用于   静态   不包含   入口   错误

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!