C# - Environment.UserInteractive Property with Example

In this tutorial, we will learn about the C# Environment.UserInteractive property with its definition, usage, syntax, and example. By Nidhi Last updated : March 30, 2023

Environment.UserInteractive Property

The Environment.UserInteractive property returns a boolean value, true if the process is running in user interactive mode or not.

Syntax

bool Environment.UserInteractive

Parameter(s)

  • None

Return Value

This property returns a 'bool' value.

C# Example of Environment.UserInteractive Property

The source code to check whether a process is running in user interactive mode or not using Environment class is given below. The given program is compiled and executed successfully.

using System;

class Sample {
  //Entry point of Program
  static public void Main() {
    bool isUserInteractiveMode = false;

    isUserInteractiveMode = Environment.UserInteractive;

    if (isUserInteractiveMode == true)
      Console.WriteLine("Process is running in user interactive mode");
    else
      Console.WriteLine("Process is not running in user interactive mode");
  }
}

Output

Process is running in user interactive mode
Press any key to continue . . .

C# Environment Class Programs »





Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.