using System.Collections.Generic;
using System.Threading.Tasks;
using System.Windows.Threading;
public static void Main()
var result = Threadedthing.Instance.GetThing();
Console.WriteLine(result);
public class Threadedthing
private static Threadedthing _instance;
private static object _instanceLock = new object();
public static Threadedthing Instance
_instance = new Threadedthing();
private Dispatcher _dispatcher;
var tcs = new TaskCompletionSource<Dispatcher>();
_dispatcher = System.Windows.Threading.Dispatcher.CurrentDispatcher;
_thread = new Thread(new ThreadStart(() => { tcs.SetResult(Dispatcher.CurrentDispatcher);}));
if (Thread.CurrentThread != _thread)
return _dispatcher.Invoke<string>(GetThing1);
public string GetThing1()