Esempio n. 1
0
        // complex (multi-value) property access methods
        #region complex properties

        public int ValueCount(string property_name)
        {
            ValueList working_vl = _DocNodeRef.GetList(property_name, VALUE_SUBSCRIPT);
            int       result     = working_vl.Length;

            working_vl.Close();
            return(result);

            // we can't just return ...GetList(...).Length because we need to close the VL object explicitly
        }
        static void GetData(NodeReference node)
        {
            Object value = node.GetObject();

            if (value is string)
            {
                if ((node.GetSubscriptCount() == 1) || (node.GetSubscriptCount() == 2))
                {
                    Console.WriteLine(value.ToString());
                }
                else if (node.GetSubscriptCount() == 5)
                {
                    ValueList outList = node.GetList();
                    outList.ResetToFirst();

                    for (int i = 0; i < outList.Length - 1; i++)
                    {
                        Console.Write(outList.GetNextObject() + ", ");
                    }
                    Console.WriteLine(outList.GetNextObject());
                    outList.Close();
                }
                else if (node.GetSubscriptCount() == 4)
                {
                    string tempString = Encoding.GetEncoding(1251).GetString(node.GetBytes());
                    Console.WriteLine(tempString);
                }
            }
            else if (value is double)
            {
                Console.WriteLine(value.ToString());
            }
            else if (value is int)
            {
                Console.WriteLine(value.ToString());
            }
        }