public T GetCounterMetadataValue <T> (string counterName, string propertyName) { var counter = session.GetCounterByIDOrName(counterName); var metadata = counter.LastValue.Metadata; if (metadata != null && metadata.TryGetValue(propertyName, out var property)) { return((T)Convert.ChangeType(property, typeof(T))); } return(default(T)); }