question

MunemMaruf-9683 avatar image
0 Votes"
MunemMaruf-9683 asked ·

System.Threading namespace is not working/appearing

I am developing a novice level test xamarin test project since I am new to this technology. I need to add a static variable of type Timer using the System.Threading namespace as follows,

private static Timer timer;

But, it doesn't seem to work. I did the following things to try to make it work.

  • added the nuget package manager manually

  • In reference, .NET --> right click View in object browser --> select System.Threading --> clicked add reference to the selected project

*Unfortunately the website is not uploading the screenshots



windows-uwp-xaml
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

RoyLi-MSFT avatar image
1 Vote"
RoyLi-MSFT answered ·

Hello,

Welcome to Microsoft Q&A!

Xamarin Forms project contains System.Threading namespace. You just add the following in .cs file and please avoid adding the System.Threading with reference browser.

 using System.Threading;
     using System.Threading.Tasks;
     using Xamarin.Forms;
        
     namespace App58
     {
            
         public partial class MainPage : ContentPage
         {
             public MainPage()
             {
                 InitializeComponent();
                    
             }
             private static Timer timer;
         }
     }
· Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.