当前位置: 首页>>代码示例>>C#>>正文


C# SettingsPropertyValueCollection.Remove方法代码示例

本文整理汇总了C#中System.Configuration.SettingsPropertyValueCollection.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# SettingsPropertyValueCollection.Remove方法的具体用法?C# SettingsPropertyValueCollection.Remove怎么用?C# SettingsPropertyValueCollection.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Configuration.SettingsPropertyValueCollection的用法示例。


在下文中一共展示了SettingsPropertyValueCollection.Remove方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Remove

		public void Remove ()
		{
			SettingsPropertyValueCollection col = new SettingsPropertyValueCollection ();
			SettingsProperty test_prop = new SettingsProperty ("test_prop");
			SettingsPropertyValue val = new SettingsPropertyValue (test_prop);

			col.Add (val);

			Assert.AreEqual (1, col.Count, "A1");

			col.Remove ("test_prop");

			Assert.AreEqual (0, col.Count, "A2");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:14,代码来源:SettingsPropertyValueCollectionTest.cs

示例2: GetProfileDataFromTable


//.........这里部分代码省略.........
                    continue;
                }
                string[] chunk = persistenceData.Split(new char[] { ';' });
                if (chunk.Length != 2)
                {
                    // REVIEW: Perhaps we should throw instead?
                    continue;
                }
                if (chunk[1].ToLower() == "int")
                    chunk[1] = "integer";
                string columnName = chunk[0];
                // REVIEW: Should we ignore case?
                OleDbType datatype = (OleDbType)Enum.Parse(typeof(OleDbType), chunk[1], true);

                columnData.Add(new ProfileColumnData(columnName, prop, null /* not needed for get */, datatype));
                commandText.Append(", ");
                commandText.Append("t." + columnName);
                ++columnCount;
            }

            commandText.AppendFormat(" FROM {0} t, {1}MEMBERS u WHERE ",TableName,Config.MemberTablePrefix).AppendLine();
            commandText.Append("u.M_NAME = @Username AND t.UserID = u.MEMBER_ID");
            cmd.CommandText = commandText.ToString();
            cmd.CommandType = CommandType.Text;
            cmd.Parameters.AddWithValue("@Username", username);
            OleDbDataReader reader = null;

            try
            {
                reader = cmd.ExecuteReader();
                //If no row exists in the database, then the default Profile values
                //from configuration are used.
                if (reader.Read())
                {
                    svc.Clear();
                    int userId = reader.GetInt32(0);
                    for (int i = 0; i < columnData.Count; ++i)
                    {
                        object val = reader.GetValue(i + 1);
                        ProfileColumnData colData = columnData[i];
                        SettingsPropertyValue propValue = new SettingsPropertyValue(colData.PropertyValue);

                        //Only initialize a SettingsPropertyValue for non-null values
                        //if (!(val is DBNull || val == null))
                        //{
                        propValue.IsDirty = false;
                        if (propValue.Property.SerializeAs == SettingsSerializeAs.Xml)
                        {
                            propValue.Deserialized = false;
                            object test = "";
                            if (!val.Equals(test))
                                propValue.SerializedValue = val;
                        }
                        else
                        {
                            propValue.PropertyValue = val;
                            propValue.Deserialized = true;
                        }

                        svc.Add(propValue);
                        //}
                    }

                    // need to close reader before we try to update the user
                    if (reader != null)
                    {
                        reader.Close();
                        reader = null;
                    }

                    //UpdateLastActivityDate(conn, userId);
                }
                else
                {
                    object val = GetBookMarkModValues(username);
                    ProfileColumnData colData = columnData.Find(c => c.ColumnName == "BookMarks");
                    SettingsPropertyValue propValue = new SettingsPropertyValue(colData.PropertyValue);
                    propValue.IsDirty = false;
                    if (propValue.Property.SerializeAs == SettingsSerializeAs.Xml)
                    {
                        if (propValue.Name == "BookMarks")
                        {
                            svc.Remove("BookMarks");
                            propValue.Deserialized = false;
                            object test = "";
                            if (!val.Equals(test))
                                propValue.SerializedValue = val;
                            svc.Add(propValue);
                        }
                    }
                }
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
        }
开发者ID:huwred,项目名称:SnitzDotNet,代码行数:101,代码来源:Profile.cs

示例3: ReadOnly_Remove

		public void ReadOnly_Remove ()
		{
			SettingsPropertyValueCollection col = new SettingsPropertyValueCollection ();

			SettingsProperty test_prop = new SettingsProperty ("test_prop");
			SettingsPropertyValue val = new SettingsPropertyValue (test_prop);
			col.Add (val);

			col.SetReadOnly ();

			col.Remove ("test_prop");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:12,代码来源:SettingsPropertyValueCollectionTest.cs


注:本文中的System.Configuration.SettingsPropertyValueCollection.Remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。