private CheckedRet <T> TryGet_ <T> (string name) { var t = typeof(T); NamedObjectDict dic2 = null; if (mDic.TryGetValue(t, out dic2)) { throw new Exception("Target type is missing."); } ; if (dic2.IsNull()) { return(CheckedRet <T> .Fail()); } object value = null; if (dic2.TryGetValue(name, out value)) { return(CheckedRet <T> .Fail()); } ; if (value.IsNull()) { return(CheckedRet <T> .Fail()); } var ret = (T)value; return(CheckedRet <T> .Gen(true, ret)); }
public static void Register(this IExcuter context, Expression expression) { var expressions = expression.Releateds; if (expressions == null || !expressions.Any()) { return; } foreach (var ex in expressions.Where(e => e.Mode != TypeMode.Expression)) { if (string.IsNullOrEmpty(ex.Data)) { continue; } Type type; if (typeDict.TryGetValue(ex.Data, out type) == false) { lock (typeDict) { type = typeDict.FetchType(ex.Data); } } if (type == null) { continue; } switch (ex.Mode) { case TypeMode.ReleatedType: context.RegisterType(type); break; case TypeMode.Static: context.RegisterStaticMember(type); break; } } }