本文整理汇总了C#中System.Collections.Dictionary.put方法的典型用法代码示例。如果您正苦于以下问题:C# Dictionary.put方法的具体用法?C# Dictionary.put怎么用?C# Dictionary.put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Dictionary
的用法示例。
在下文中一共展示了Dictionary.put方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: addCoocs
/**
* Adds coocs to term.
* @param content content
* @param str term
* @param coocs list of coocs per term
*/
private void addCoocs( List<String> content, String str,
Dictionary<String, Dictionary<String, int>> coocs) {
Dictionary<String, int> strcoocs = coocs.get(str);
if (strcoocs == null) { strcoocs = new Dictionary<String, int>(); }
for (String s : content) {
if (!s.equals(str)) {
if (strcoocs.containsKey(s)) {
int tmp = strcoocs.get(s) + 1;
strcoocs.put(s, tmp);
} else {
strcoocs.put(s, 1);
}
}
}
coocs.put(str, strcoocs);
}
示例2: reopenConnection
private void reopenConnection()
{
if (_connection != null)
{
return;
}
_connection = _transport.openFetch();
// Since we opened a new connection we cannot be certain
// that the system we connected to has the same exact set
// of objects available (think round-robin DNS and mirrors
// that aren't updated at the same time).
//
// We rebuild our askFor list using only the refs that the
// new connection has offered to us.
//
IDictionary<ObjectId, Ref> avail = new Dictionary<ObjectId, Ref>();
foreach (Ref r in _connection.Refs)
{
avail.put(r.getObjectId(), r);
}
ICollection<Ref> wants = new List<Ref>(_askFor.Values);
_askFor.Clear();
foreach (Ref want in wants)
{
Ref newRef = avail.get(want.ObjectId);
if (newRef != null)
{
_askFor.put(newRef.ObjectId, newRef);
}
else
{
removeFetchHeadRecord(want.ObjectId);
removeTrackingRefUpdate(want.ObjectId);
}
}
}
示例3: addTuples
/**
* Adds tuples to term.
* @param tuple tuple
* @param str term
* @param termTuples list of tuples per term
*/
private void addTuples( PointEvent<TwitterDataTerm> tuple, String str, Dictionary<String, ISet<PointEvent<TwitterDataTerm>>> termTuples) {
ISet<PointEvent<TwitterDataTerm>> tuples = termTuples.get(str);
if (tuples == null) { tuples = new HashSet<PointEvent<TwitterDataTerm>>(); }
tuples.add(tuple);
termTuples.put(str, tuples);
}