修饰符public对此项无效

编程入门 行业动态 更新时间:2024-10-27 17:25:05
本文介绍了修饰符public对此项无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

课程

{Main()

{

{

//一些代码

//some code

计划p =新计划();

Program p = new Program();

p.TranslateMorse();

p.TranslateMorse();

} public string TranslateMorse() { string input = Console.ReadLine(); string output = string.Empty; $ char [] splitInputString = input.Trim()。ToLower()。ToCharArray(); $ foreach(splInputString中的char c) { int index = Array.IndexOf(english,c); 输出+ =''+莫尔斯[指数]; } // string [] outputarray = new string [] {output}; using(System.IO.StreamWriter file = new System.IO.StreamWriter(path2,true) ) { file.WriteLine(输出); } //File.WriteAllLines(path2,outputarray); Console.WriteLine(输出); Console.ReadKey(false); } }

} public string TranslateMorse() { string input = Console.ReadLine(); string output = string.Empty; char[] splitInputString = input.Trim().ToLower().ToCharArray(); foreach (char c in splitInputString) { int index = Array.IndexOf(english, c); output += ' ' + morse[index]; } // string[] outputarray = new string[] { output }; using (System.IO.StreamWriter file = new System.IO.StreamWriter(path2, true)) { file.WriteLine(output); } //File.WriteAllLines(path2, outputarray); Console.WriteLine(output); Console.ReadKey(false); } }

}

}

您好,

i我试图将英文文本转换为莫尔斯代码。并编写了这种方法。

i am trying to convert english text to morse code. and have written this method.

但在编译此错误时显示ie; "修饰符public对此项目无效" 。

but when compiling this error is shown ie; "the modifier public is not valid for this item" .

我是编程和初学者无法解决这个问题..任何人都可以告诉我如何解决这个错误。

i'm a beginner in programming & couldnt solve this issue.. could any one pls tell me how to solve this error .

非常感谢,

many thanks,

推荐答案

将Main声明为

declare Main as static void Main()

更多推荐

修饰符public对此项无效

本文发布于:2023-11-09 19:26:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1573222.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:此项   修饰符   public

发布评论

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

>www.elefans.com

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