Skip to content

Commit 704b322

Browse files
committed
refactor: 代码重构
1 parent ba128bf commit 704b322

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/BootstrapBlazor/Components/Upload/UploadBase.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,20 +133,19 @@ protected async Task OnFileChange(InputFileChangeEventArgs args)
133133
await OnAllFileUploaded(items);
134134
}
135135

136-
var type = NullableUnderlyingType ?? typeof(TValue);
137-
if (type.IsAssignableTo(typeof(IEnumerable<IBrowserFile>)))
136+
if (ValueType.IsAssignableTo(typeof(IEnumerable<IBrowserFile>)))
138137
{
139138
CurrentValue = (TValue)(object)items.Select(f => f.File).ToList();
140139
}
141-
else if (type.IsAssignableTo(typeof(IEnumerable<string>)))
140+
else if (ValueType.IsAssignableTo(typeof(IEnumerable<string>)))
142141
{
143142
CurrentValue = (TValue)(object)string.Join(";", items.Select(f => f.OriginFileName)).ToList();
144143
}
145-
else if (type == typeof(IBrowserFile))
144+
else if (ValueType == typeof(IBrowserFile))
146145
{
147146
CurrentValue = (TValue)(object)items[0].File!;
148147
}
149-
else if (type == typeof(string))
148+
else if (ValueType == typeof(string))
150149
{
151150
CurrentValue = (TValue)(object)string.Join(";", items.Select(f => f.OriginFileName));
152151
}

0 commit comments

Comments
 (0)