File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ public unsafe struct ComHeapPtr<T> : IDisposable where T : unmanaged
1616 private T * _ptr ;
1717
1818 public bool IsNull
19- => _ptr == default ;
19+ => _ptr == null ;
2020
2121 public ComHeapPtr ( T * ptr )
2222 {
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ public unsafe struct ComPtr<T> : IDisposable where T : unmanaged
1616 private T * _ptr ;
1717
1818 public bool IsNull
19- => _ptr == default ;
19+ => _ptr == null ;
2020
2121 public ComPtr ( T * ptr )
2222 {
@@ -38,6 +38,14 @@ public ComPtr(T* ptr)
3838 return ( T * * ) Unsafe . AsPointer ( ref Unsafe . AsRef ( in this ) ) ;
3939 }
4040
41+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
42+ public readonly ComPtr < U > As < U > ( Guid riid ) where U : unmanaged
43+ {
44+ ComPtr < U > pNewPtr = default ;
45+ ( ( IUnknown * ) _ptr ) ->QueryInterface ( & riid , ( void * * ) pNewPtr . GetAddressOf ( ) ) ;
46+ return pNewPtr ;
47+ }
48+
4149 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
4250 public void Dispose ( )
4351 {
You can’t perform that action at this time.
0 commit comments