You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<param name="icon">The <see cref="T:Microsoft.FluentUI.AspNetCore.Components.IconInfo"/> to instantiate.</param>
5133
+
<param name="throwOnError">true to throw an exception if the type is not found (default); false to return null.</param>
5133
5134
<remarks>
5134
5135
This method requires dynamic access to code. This code may be removed by the trimmer.
5135
5136
If the assembly is not yet loaded, it will be loaded by the method `Assembly.Load`.
@@ -5138,6 +5139,19 @@
5138
5139
<returns></returns>
5139
5140
<exception cref="T:System.ArgumentException">Raised when the <see cref="P:Microsoft.FluentUI.AspNetCore.Components.IconInfo.Name"/> is not found in predefined icons.</exception>
<param name="icon">The <see cref="T:Microsoft.FluentUI.AspNetCore.Components.IconInfo"/> to instantiate.</param>
5147
+
<param name="result">When this method returns, contains the <see cref="T:Microsoft.FluentUI.AspNetCore.Components.CustomIcon"/> value if the conversion succeeded, or null if the conversion failed. This parameter is passed uninitialized; any value originally supplied in result will be overwritten.</param>
5148
+
<remarks>
5149
+
This method requires dynamic access to code. This code may be removed by the trimmer.
5150
+
If the assembly is not yet loaded, it will be loaded by the method `Assembly.Load`.
5151
+
To avoid any issues, the assembly must be loaded before calling this method (e.g. adding an icon in your code).
5152
+
</remarks>
5153
+
<returns>True if the icon was found and created; otherwise, false.</returns>
@@ -49,7 +50,30 @@ public static CustomIcon GetInstance(this IconInfo icon)
49
50
}
50
51
}
51
52
52
-
thrownewArgumentException($"Icon 'Icons.{icon.Variant}.Size{(int)icon.Size}.{icon.Name}' not found.");
53
+
if(throwOnError==true||throwOnError==null)
54
+
{
55
+
thrownewArgumentException($"Icon 'Icons.{icon.Variant}.Size{(int)icon.Size}.{icon.Name}' not found.");
56
+
}
57
+
58
+
returndefault!;
59
+
}
60
+
61
+
/// <summary>
62
+
/// Tries to return a new instance of the icon.
63
+
/// </summary>
64
+
/// <param name="icon">The <see cref="IconInfo"/> to instantiate.</param>
65
+
/// <param name="result">When this method returns, contains the <see cref="CustomIcon"/> value if the conversion succeeded, or null if the conversion failed. This parameter is passed uninitialized; any value originally supplied in result will be overwritten.</param>
66
+
/// <remarks>
67
+
/// This method requires dynamic access to code. This code may be removed by the trimmer.
68
+
/// If the assembly is not yet loaded, it will be loaded by the method `Assembly.Load`.
69
+
/// To avoid any issues, the assembly must be loaded before calling this method (e.g. adding an icon in your code).
70
+
/// </remarks>
71
+
/// <returns>True if the icon was found and created; otherwise, false.</returns>
72
+
[RequiresUnreferencedCode("This method requires dynamic access to code. This code may be removed by the trimmer.")]
0 commit comments