XamlType.CanAssignTo(XamlType) Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
public:
virtual bool CanAssignTo(System::Xaml::XamlType ^ xamlType);
public virtual bool CanAssignTo (System.Xaml.XamlType xamlType);
abstract member CanAssignTo : System.Xaml.XamlType -> bool
override this.CanAssignTo : System.Xaml.XamlType -> bool
Public Overridable Function CanAssignTo (xamlType As XamlType) As Boolean
true
if xamlType
is in the assignable types list; otherwise, false
.
Although the assignable type does not have all the capabilities of the reference type, you can use it for assignment. For example, you can use assignment to make type matches for the values of a property. The concept of assignable types in XAML is similar to the concept of casting up in the CLR type system. For example, under a CLR type system, every type has an Object in its assignable type list.
If one of the two XamlType instances that are used for comparison has IsUnknown equal to true
, this method has a special Unknown mode that returns true
if the two XamlType instances are equivalent.
The default implementation uses the CLR Type from UnderlyingType for this XamlType and the input XamlType, and calls IsAssignableFrom. Override this method if you want a different determination of assignable types.
Passing a null xamlType
does not throw an exception and always returns false
.
Σημαντικό
CanAssignTo is virtual, and therefore, can be overridden. The override has the potential (whether for malicious purposes or otherwise) to change the assignability of a XAML type so that it no longer aligns in an expected way with the type-casting behavior of its underlying CLR type. For any security-critical checks of assignment operations and access, use the underlying CLR type instead.
Προϊόν | Εκδόσεις |
---|---|
.NET Framework | 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
.NET σχόλια
.NET είναι ένα έργο ανοιχτού κώδικα. Επιλέξτε μια σύνδεση για να παρέχετε σχόλια: