C#无法识别方法 [英] C# Doesn't recognize method
问题描述
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace dShell
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
////METODLAR////
public void ConsoleWriteLine(string text)
{
String.Concat(RTB.Text, text);
String.Concat(RTB.Text, "\n");
}
ConsoleWriteLine("hi");
}
}
所以"ConsoleWriteLine();不行。我尝试添加静电,但它打破了"RTB"并导致我重写所有< g class =" gr_ gr_162 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar multiReplace"数据-GR-ID =" 162"
id =" 162"> project< / g>。
So the "ConsoleWriteLine(); Doesn't work. I tried adding static but it broke "RTB" and caused me to rewrite all of the <g class="gr_ gr_162 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar multiReplace" data-gr-id="162" id="162">project</g>.
推荐答案
每次执行代码都以Main()方法开始。由于ConsoleWriteLine(字符串文本)是一种方法,您应该创建一个main方法,然后尝试执行ConsoleWriteLine("hi")。
Every execution of a code starts with the Main() method. Since ConsoleWriteLine(string text) is a method, you should create a main method and then try executing ConsoleWriteLine("hi").
问候,
Shreyash
这篇关于C#无法识别方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!