本文整理汇总了C#中Preferences.put方法的典型用法代码示例。如果您正苦于以下问题:C# Preferences.put方法的具体用法?C# Preferences.put怎么用?C# Preferences.put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Preferences
的用法示例。
在下文中一共展示了Preferences.put方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: loadNode
private static void loadNode(Preferences prefs, org.w3c.dom.Element node)
{
//throws TransformerException {
// load preferences
org.w3c.dom.NodeList children = org.apache.xpath.XPathAPI.selectNodeList (node, "node"); //$NON-NLS-1$
org.w3c.dom.NodeList entries = org.apache.xpath.XPathAPI.selectNodeList (node, "map/entry"); //$NON-NLS-1$
int childNumber = children.getLength ();
Preferences[] prefChildren = new Preferences[childNumber];
int entryNumber = entries.getLength ();
lock (((AbstractPreferences) prefs).lockJ) {
if (((AbstractPreferences)prefs).isRemoved ()) {
return;
}
for (int i = 0; i < entryNumber; i++) {
org.w3c.dom.Element entry = (org.w3c.dom.Element)entries.item (i);
String key = entry.getAttribute ("key"); //$NON-NLS-1$
String value = entry.getAttribute ("value"); //$NON-NLS-1$
prefs.put (key, value);
}
// get children preferences node
for (int i = 0; i < childNumber; i++) {
org.w3c.dom.Element child = (org.w3c.dom.Element)children.item (i);
String name = child.getAttribute ("name"); //$NON-NLS-1$
prefChildren [i] = prefs.node (name);
}
}
// load children nodes after unlock
for (int i = 0; i < childNumber; i++) {
loadNode (prefChildren [i], (org.w3c.dom.Element)children.item (i));
}
}