public string GetPropertyStringValue(PropertyStoreProperty property) { if (_propertyStore == null) { return(null); } using (var propertyValue = new NativeMethods.PROPVARIANT()) { _propertyStore.GetValue(NativeMethods.GetPkey(property), propertyValue); return(propertyValue.GetString()); } }
public object GetValue(PROPERTYKEY key) { var pv = IntPtr.Zero; object value = null; try { pv = Marshal.AllocCoTaskMem(16); m_IPropertyStore.GetValue(key, pv); try { value = PropVariant.ToObject(pv); } catch (Exception err) { throw new ApplicationException("Unsupported property data type", err); } } finally { if (pv != (IntPtr)0) { try { NativeMethods.PropVariantClear(pv); } catch { Debug.Fail("VariantClear failure"); } Marshal.FreeCoTaskMem(pv); pv = IntPtr.Zero; } } return(value); }