本文整理汇总了C#中Commons.Collections.ExtendedProperties.AddPropertyDirect方法的典型用法代码示例。如果您正苦于以下问题:C# ExtendedProperties.AddPropertyDirect方法的具体用法?C# ExtendedProperties.AddPropertyDirect怎么用?C# ExtendedProperties.AddPropertyDirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Commons.Collections.ExtendedProperties
的用法示例。
在下文中一共展示了ExtendedProperties.AddPropertyDirect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Subset
/// <summary> Create an ExtendedProperties object that is a subset
/// of this one. Take into account duplicate keys
/// by using the setProperty() in ExtendedProperties.
/// *
/// </summary>
/// <param name="prefix">prefix
///
/// </param>
public ExtendedProperties Subset(String prefix)
{
ExtendedProperties c = new ExtendedProperties();
bool validSubset = false;
foreach(Object key in Keys)
{
if (key is String && ((String) key).StartsWith(prefix))
{
if (!validSubset)
validSubset = true;
String newKey;
/*
* Check to make sure that c.subset(prefix) doesn't
* blow up when there is only a single property
* with the key prefix. This is not a useful
* subset but it is a valid subset.
*/
if (((String) key).Length == prefix.Length)
{
newKey = prefix;
}
else
{
newKey = ((String) key).Substring(prefix.Length + 1);
}
/*
* use addPropertyDirect() - this will plug the data as
* is into the Map, but will also do the right thing
* re key accounting
*/
c.AddPropertyDirect(newKey, this[key]);
}
}
if (validSubset)
{
return c;
}
else
{
return null;
}
}