l cannot find the Windows.Devices.Sensors Namespace.

kil_dren 02 0 Reputation points
2023-09-14T23:56:15.7266667+00:00

l wish to access the Windows Ambient lights sensors on a windows forms app using C# but l cannot find the reference for system device sensors

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,832 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,395 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,272 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Castorix31 81,736 Reputation points
    2023-09-15T06:10:29.4966667+00:00

    Add References :

    "C:\Program Files (x86)\Windows Kits\10\UnionMetadata\[version]\Windows.winmd"

    and

    "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll"

    then

    using Windows.Devices.Sensors;