Created
May 4, 2016 17:14
-
-
Save JonDouglas/0d83603460e28deccc5ad4991913a6bd to your computer and use it in GitHub Desktop.
Main Thread
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thread uiThread; | |
uiThread = Thread.CurrentThread; //Ensure this is called during a Main/UI thread call | |
void WhatThreadAmI([CallerMemberName] string method = "", [CallerLineNumber] int line = 0) | |
{ | |
Console.WriteLine("========================="); | |
Console.WriteLine("========================="); | |
Console.WriteLine("========================="); | |
Console.WriteLine($"{method} - {line}" {IsMainThread}"); | |
Console.WriteLine("========================="); | |
Console.WriteLine("========================="); | |
Console.WriteLine("========================="); | |
} | |
public bool IsMainThread => uiThread == Thread.Current; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment