C#静态方法和控制台

C#静态方法和控制台,c#,methods,static,console,C#,Methods,Static,Console,嗨,我在一个类中有一个static方法,在我的控制台应用程序中,我像这样使用 Console.writeLine("Some thing Some thing"); Console.writeLine("Some thing Some thing"); String X=ClassName.Method(Para); <--- Check here Console.writeLine("Some thing after some thing "); Console.writeLi

嗨,我在一个类中有一个static方法,在我的控制台应用程序中,我像这样使用

Console.writeLine("Some thing Some thing");

Console.writeLine("Some thing Some thing");

String X=ClassName.Method(Para); <--- Check here


Console.writeLine("Some thing after some thing ");

Console.writeLine("Some thing after some thing ");
Console.writeLine(“某物某物”);
Console.writeLine(“某物某物”);

字符串X=ClassName.Method(Para) 停止应用程序的问题在于
ClassName.Method(Para)
调用,如果该方法阻止了应用程序,您应该进一步查看。

您的方法可能会引发异常或阻止(不返回)

要判断是否引发了异常,请在方法周围放置try/catch,并在catch块中打印所有异常

try
{    
String X=ClassName.Method(Para); <--- Check here
}
catch (Exception e)
{
Console.WriteLine("{0}", e);
}
试试看
{    

String X=ClassName.Method(Para);尝试此操作以查找调用函数中是否发生任何错误:

Console.writeLine("Some thing Some thing");    
Console.writeLine("Some thing Some thing");    

try
{    
String X=ClassName.Method(Para); <--- Check here
}    

catch(Exception e)
{
Console.writeLine(e.Message);
}

Console.writeLine("Some thing after some thing ");    
Console.writeLine("Some thing after some thing ");
Console.writeLine(“某物某物”);
Console.writeLine(“某物某物”);
尝试
{    

String X=ClassName.Method(Para);这不是正常的行为。给我们更多的代码pls,它会“像暂停一样”意思是?您是否尝试过try/catch或调试并进入静态函数?请向我们展示调用静态方法的真实代码以及静态方法本身,而不是伪代码。
String X=ClassName.method(Para);