Skip to content

Commit f7b1e71

Browse files
committed
refactor: 直接接口
1 parent 2040c95 commit f7b1e71

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/BootstrapBlazor/Extensions/ObjectExtensions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,11 @@ internal static void Clone<TModel>(this TModel source, TModel item)
246246
/// <returns>An instance of the specified type with initialized properties.</returns>
247247
public static TItem? CreateInstance<TItem>(bool isAutoInitializeModelProperty = false)
248248
{
249+
if(typeof(TItem).IsInterface)
250+
{
251+
return default;
252+
}
253+
249254
var instance = Activator.CreateInstance<TItem>();
250255
if (isAutoInitializeModelProperty)
251256
{

0 commit comments

Comments
 (0)