articles » current » blazor » wasm » log-to-console

Blazor: Log to the Console Example

An example of how to log information to the browser's console window for debugging purposes

Console.WriteLine() in C# is just like console.log in JavaScript.

@page "/consoleexample"

@code {
	protected override async Task OnInitializedAsync()
	{
		await base.OnInitializedAsync();
		Console.WriteLine("Hello, World!");
	}
}

This site uses cookies. Cookies are simple text files stored on the user's computer. They are used for adding features and security to this site. Read the privacy policy.
CLOSE