RaUI/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/FieldAccessorPool.cs
鑫Intel 8b41f58f5c ### 2021-07-01更新
------
#### ryControlsV4    V3.0.2107.0101
- *.[新增]新增Sheng.Winform.Controls部分控件。

#### RyWeb    V3.0.2107.0101
- *.[新增]QuickWeb新增引用页设置。
#### MyDbV4    V3.0.2107.0101
- *.[新增]支持忽略大小写的替换功能。
2021-07-04 09:41:31 +08:00

32 lines
861 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.Diagnostics;
namespace Sheng.Winform.Controls.Kernal
{
public class FieldAccessorPool : FastReflectionPool<string,IFieldAccessor>
{
protected override IFieldAccessor Create(Type type, string key)
{
if (type == null || String.IsNullOrEmpty(key))
{
Debug.Assert(false, "type 或 key 为空");
throw new ArgumentNullException();
}
FieldInfo fieldInfo = type.GetField(key);
if (fieldInfo == null)
{
Debug.Assert(false, "没有指定的FieldInfo:" + key);
throw new MissingFieldException(key);
}
return new FieldAccessor(fieldInfo);
}
}
}