Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JLChnToZ committed May 30, 2023
1 parent 4ecec2e commit 6435bdf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion JLChnToZ.CommonUtils.Dynamic/TypeInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ internal bool TryGetValue(object instance, string key, out object value) {

internal bool TryGetValue(object instance, object[] indexes, out object value) {
PropertyInfo matched;
if (indexes == null) indexes = emptyArgs;
if (indexes == null || indexers.Length == 0) {
value = null;
return false;
}
matched = Type.DefaultBinder.SelectProperty(
DEFAULT_FLAGS | BindingFlags.GetProperty, indexers, null, Array.ConvertAll(indexes, GetUndelyType), null
);
Expand Down Expand Up @@ -106,6 +109,7 @@ internal bool TrySetValue(object instance, string key, object value) {

internal bool TrySetValue(object instance, object[] indexes, object value) {
PropertyInfo matched;
if (indexes == null || indexers.Length == 0) return false;
matched = Type.DefaultBinder.SelectProperty(
DEFAULT_FLAGS | BindingFlags.SetProperty, indexers, null, Array.ConvertAll(indexes, GetUndelyType), null
);
Expand Down

0 comments on commit 6435bdf

Please sign in to comment.