Windows.Foundation.IReference

April 12, 2023 ยท View on GitHub

-description

Enables arbitrary enumerations, structures, and delegate types to be used as property values.

.NET This interface appears as Nullable<T>.

C++/CX This interface appears as Platform::IBox<T>

-remarks

When programming with .NET, this interface is hidden, and you should use the Nullable<T> class. All Windows Runtime members where the basic IDL signature shows IReference (with a constraint) are, instead, exposed using the syntax of the nullable value type (for example, bool? in C#).

When programming with C++/CX, this interface is hidden, and you should use the Platform::IBox<T> interface. All Windows Runtime members where the basic IDL signature shows IReference (with a constraint) are instead exposed using Platform::IBox<T> with the template as a particular value type. This is how C++/CX implements nullable value types. For more info, see Value classes and structs (C++/CX).

Because both .NET and C++/CX have projection equivalents, don't implement this interface unless you are using WRL and/or writing code for a Windows Runtime component, and need a nullable value type.

Interface inheritance

IReference<T> inherits IPropertyValue. Types that implement IReference<T> also implement the interface members of IPropertyValue.

-examples

bool flag = myScrollViewer.ChangeView(2d, null, null);
bool flag{ myScrollViewer.ChangeView(Windows::Foundation::IReference<double>{2.f}, nullptr, nullptr) };

-see-also

IPropertyValue, Nullable<T>, Platform::IBox<T>, Value classes and structs (C++/CX)