Console unavailable in class library c#

后端 未结 2 761
后悔当初
后悔当初 2021-02-19 15:15

This question here seems contrary to what I have experienced. I cannot access the console from within a new class library. I have using System; at the top. I am usi

相关标签:
2条回答
  • 2021-02-19 15:48

    If you created a Metro style application, there's no Console in WinRT. Don't search for it as you won't find any. This is explained in this article:

    The subset of managed types and members was designed with a clear focus on Metro style app development. As a result, it omits the following:

    • Types and members that are not applicable to developing Metro style apps (such as console and ASP.NET types).

    • Obsolete and legacy types.

    • Types that overlap with Windows Runtime types.

    • Types and members that wrap operating system functionality (such as System.Diagnostics.EventLog and performance counters).

    • Members that cause confusion (such as the Close method on I/O types).

    You could use the debugging API or logging framework.

    0 讨论(0)
  • 2021-02-19 16:01
    System.Diagnostics.Debug.WriteLine("test");
    

    https://msdn.microsoft.com/en-us/library/9z9k5ydz(v=vs.110).aspx

    0 讨论(0)
提交回复
热议问题