IsNull() публичный абстрактный Метод

public abstract IsNull ( DocumentObject dom ) : bool
dom DocumentObject
Результат bool
Пример #1
0
        /// <summary>
        /// Determines whether the member of dom specified by name is null.
        /// If a member with the specified name does not exist an ArgumentException will be thrown.
        /// </summary>
        public virtual bool IsNull(DocumentObject dom, string name)
        {
            //bool isNull = false;
            int dot = name.IndexOf('.');

            if (dot == 0)
            {
                throw new ArgumentException(DomSR.InvalidValueName(name));
            }
            string trail = null;

            if (dot > 0)
            {
                trail = name.Substring(dot + 1);
                name  = name.Substring(0, dot);
            }
            ValueDescriptor vd = this.vds[name];

            if (vd == null)
            {
                throw new ArgumentException(DomSR.InvalidValueName(name));
            }

            if (vd is NullableDescriptor || vd is ValueTypeDescriptor)
            {
                if (trail != null)
                {
                    throw new ArgumentException(DomSR.InvalidValueName(name));
                }
                return(vd.IsNull(dom));
            }
            DocumentObject docObj = (DocumentObject)vd.GetValue(dom, GV.ReadOnly);

            if (docObj == null)
            {
                return(true);
            }
            if (trail != null)
            {
                return(docObj.IsNull(trail));
            }
            else
            {
                return(docObj.IsNull());
            }

            //      DomValueDescriptor vd = vds[name];
            //      if (vd == null)
            //        throw new ArgumentException(DomSR.InvalidValueName(name));
            //
            //      return vd.IsNull(dom);
        }
Пример #2
0
        /// <summary>
        /// Determines whether all members of the specified dom are null. If dom contains no members IsNull
        /// returns true.
        /// </summary>
        public bool IsNull(DocumentObject dom)
        {
            int count = _vds.Count;

            for (int index = 0; index < count; index++)
            {
                ValueDescriptor vd = _vds[index];
                if (vd.IsRefOnly)
                {
                    continue;
                }
                if (!vd.IsNull(dom))
                {
                    return(false);
                }
            }
            return(true);
        }