How do I Use Console or Output Window?

YBtheSYBtheS Member ✭✭

Hi,
I am developing a smartphone app on my Windows computer and testing it with and iPhone. I tried printing "Hello, World!" using both Debug.Write() and Console.Write() in the Main method however it did not work. How do I do this in C#?

Thanks!

Tagged:

Answers

  • EightballEightball Member ✭✭

    Debug.WriteLine(string s) only outputs values on the Debugger e.g. in VisualStudio while running the app in Debug-Mode.

    In common apps visuals are written in XML. To share your data with the screen, this View has to be written and filled with your data. I suggest to read multiple basic-guides and tutorials out there.

  • YBtheSYBtheS Member ✭✭
    edited July 28

    @Eightball said:
    Debug.WriteLine(string s) only outputs values on the Debugger e.g. in VisualStudio while running the app in Debug-Mode.

    In common apps visuals are written in XML. To share your data with the screen, this View has to be written and filled with your data. I suggest to read multiple basic-guides and tutorials out there.

    Thanks for the response. I am not trying to make it show up on my phone though. I'd like it to appear in the output window (the debugger in Visual Studio) or in a console. This, however, does not seem to work.

    Edit: Note that I am using debug mode.

  • YorkGoYorkGo CNMember, Xamarin Team Xamurai

    @YBtheS , here is the sample about how to use the Debug.Write():

    public partial class MainPage : ContentPage
        {
            public MainPage()
            {
                InitializeComponent();
    
                MyButton.Clicked += MyButton_Clicked;
            }
    
            private void MyButton_Clicked(object sender, EventArgs e)
            {
                System.Diagnostics.Debug.Write("Hello, World!");
            }
        }
    

    When clicking the button, result:

  • YBtheSYBtheS Member ✭✭
    edited July 31
    @YorkGo Okay thanks! I’ll try that and tell you if it works.
Sign In or Register to comment.