public static bool TryGetPropertyValue<T>(object obj, string propertyName, out T outValue)
var v = obj?.GetType().GetProperty(propertyName);
outValue = (T)v.GetValue(obj);
public static void Main()
var t = new TestClass() { Test = Guid.NewGuid() };
var x = TryGetPropertyValue<Guid>(t, "Testxx", out var guid) ? guid : new Guid("00000000-0000-0000-0000-000000000001");
Console.Out.WriteLine(x);
public Guid Test { get; set;}