AjTalk.Language.BaseBehavior.GetInstanceMethod C# (CSharp) Метод

GetInstanceMethod() публичный Метод

public GetInstanceMethod ( string mthname ) : IMethod
mthname string
Результат IMethod
        public IMethod GetInstanceMethod(string mthname)
        {
            if (mthname == null)
            {
                throw new ArgumentNullException("mthname");
            }

            if (!this.methods.ContainsKey(mthname))
            {
                if (this.traits != null)
                {
                    foreach (var trait in this.traits)
                    {
                        var mth = trait.GetInstanceMethod(mthname);

                        if (mth != null)
                            return mth;
                    }
                }

                if (this.superclass != null)
                {
                    return this.superclass.GetInstanceMethod(mthname);
                }

                return null;
            }

            return this.methods[mthname];
        }

Usage Example

Пример #1
0
        public void DefineInstanceMethod()
        {
            IMetaClass meta = BaseMetaClass.CreateMetaClass(null, this.machine);
            BaseBehavior behavior = new BaseBehavior(meta, null, this.machine);
            IMethod method = new Method("method");

            behavior.DefineInstanceMethod(new Method("method"));

            IMethod result = behavior.GetInstanceMethod("method");
            Assert.IsNotNull(result);
            Assert.AreEqual("method", result.Name);
        }
All Usage Examples Of AjTalk.Language.BaseBehavior::GetInstanceMethod