本文整理汇总了C#中System.Collections.Generic.IDictionary.Add方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.Generic.IDictionary.Add方法的具体用法?C# System.Collections.Generic.IDictionary.Add怎么用?C# System.Collections.Generic.IDictionary.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Generic.IDictionary
的用法示例。
在下文中一共展示了System.Collections.Generic.IDictionary.Add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Serializer
private Serializer()
{
serializers = new NeoDatis.Tool.Wrappers.Map.OdbHashMap<string, NeoDatis.Odb.Impl.Core.Layers.Layer2.Meta.Serialization.ISerializer
>();
serializers.Add(GetClassId(typeof(NeoDatis.Odb.Core.Layers.Layer2.Meta.AtomicNativeObjectInfo
)), new NeoDatis.Odb.Impl.Core.Layers.Layer2.Meta.Serialization.AtomicNativeObjectSerializer
());
serializers.Add(GetClassId(typeof(NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo
)), new NeoDatis.Odb.Impl.Core.Layers.Layer2.Meta.Serialization.CollectionObjectInfoSerializer
());
}
示例2: Read
/// <summary> Read a particular segmentFileName. Note that this may
/// throw an IOException if a commit is in process.
///
/// </summary>
/// <param name="directory">-- directory containing the segments file
/// </param>
/// <param name="segmentFileName">-- segment file to load
/// </param>
/// <throws> CorruptIndexException if the index is corrupt </throws>
/// <throws> IOException if there is a low-level IO error </throws>
public void Read(Directory directory, System.String segmentFileName)
{
bool success = false;
// Clear any previous segments:
Clear();
ChecksumIndexInput input = new ChecksumIndexInput(directory.OpenInput(segmentFileName));
generation = GenerationFromSegmentsFileName(segmentFileName);
lastGeneration = generation;
try
{
int format = input.ReadInt();
if (format < 0)
{
// file contains explicit format info
// check that it is a format we can understand
if (format < CURRENT_FORMAT)
throw new CorruptIndexException("Unknown format version: " + format);
version = input.ReadLong(); // read version
counter = input.ReadInt(); // read counter
}
else
{
// file is in old format without explicit format info
counter = format;
}
for (int i = input.ReadInt(); i > 0; i--)
{
// read segmentInfos
Add(new SegmentInfo(directory, format, input));
}
if (format >= 0)
{
// in old format the version number may be at the end of the file
if (input.GetFilePointer() >= input.Length())
version = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
// old file format without version number
else
version = input.ReadLong(); // read version
}
if (format <= FORMAT_USER_DATA)
{
if (format <= FORMAT_DIAGNOSTICS)
{
userData = input.ReadStringStringMap();
}
else if (0 != input.ReadByte())
{
userData = new System.Collections.Generic.Dictionary<string,string>();
userData.Add("userData", input.ReadString());
}
else
{
userData = new System.Collections.Generic.Dictionary<string, string>();
}
}
else
{
userData = new System.Collections.Generic.Dictionary<string, string>();
}
if (format <= FORMAT_CHECKSUM)
{
long checksumNow = input.GetChecksum();
long checksumThen = input.ReadLong();
if (checksumNow != checksumThen)
throw new CorruptIndexException("checksum mismatch in segments file");
}
success = true;
}
finally
{
input.Close();
if (!success)
{
// Clear any segment infos we had loaded so we
// have a clean slate on retry:
Clear();
}
}
}
示例3: PhotoEditorUI
private PhotoEditorUI(ArrayList selectedphotos, DeskFlickrUI.ModeSelected mode)
{
Glade.XML gxml = new Glade.XML (null, "organizer.glade", "window2", null);
gxml.Autoconnect (this);
_isconflictmode = (mode == DeskFlickrUI.ModeSelected.ConflictMode);
_isuploadmode = (mode == DeskFlickrUI.ModeSelected.UploadMode);
_isblogmode = (mode == DeskFlickrUI.ModeSelected.BlogMode);
if (mode == DeskFlickrUI.ModeSelected.BlogAndConflictMode) {
_isconflictmode = true;
_isblogmode = true;
}
_tags = new ArrayList();
_comments = new ArrayList();
window2.Title = "Edit information for " + selectedphotos.Count + " photos";
window2.SetIconFromFile(DeskFlickrUI.ICON_PATH);
notebook1.SetTabLabelText(notebook1.CurrentPageWidget, "Information");
notebook1.NextPage();
notebook1.SetTabLabelText(notebook1.CurrentPageWidget, "Tags");
notebook1.NextPage();
notebook1.SetTabLabelText(notebook1.CurrentPageWidget, "Comments");
tips = new Tooltips();
SetCommentsToolBar();
tips.Enable();
SetCommentsTree();
if (_isconflictmode) {
notebook1.NextPage();
notebook1.SetTabLabelText(notebook1.CurrentPageWidget, "Information at Server");
} else {
notebook1.RemovePage(3);
}
if (_isblogmode) {
notebook1.NextPage();
notebook1.SetTabLabelText(notebook1.CurrentPageWidget, "Blog Entry");
notebook1.Page = 3; // Default page is blog entry if editor is in Blog mode.
} else {
if (_isconflictmode) notebook1.RemovePage(4);
else notebook1.RemovePage(3);
notebook1.Page = 0; // Default page is photo editing.
}
table1.SetColSpacing(0, 50);
// Set Labels
label6.Text = "Edit";
label5.Text = "Title:";
label4.Text = "Description:";
label3.Text = "Visibility:";
label2.Text = "License:";
if (_isuploadmode) label2.Sensitive = false;
// Labels for blog tab.
label17.Text = "Title: ";
label18.Text = "Description: ";
// Search box
label15.Markup = "<span weight='bold'>Search: </span>";
entry2.Changed += new EventHandler(OnFilterEntryChanged);
// Revert button
button9.Label = "Revert Photo(s)";
button9.Clicked += new EventHandler(OnRevertButtonClicked);
// entry1.ModifyFont(Pango.FontDescription.FromString("FreeSerif 10"));
SetPrivacyComboBox();
SetLicenseComboBox();
SetTagTreeView();
// Make previous and next buttons insensitive. They'll become sensitive
// only when the user ticks the 'Per Photo' checkbutton.
button3.Sensitive = false;
button4.Sensitive = false;
checkbutton1.Toggled += new EventHandler(OnPerPageCheckToggled);
button3.Clicked += new EventHandler(OnPrevButtonClick);
button4.Clicked += new EventHandler(OnNextButtonClick);
button5.Clicked += new EventHandler(OnSaveButtonClick);
button6.Clicked += new EventHandler(OnCancelButtonClick);
entry1.Changed += new EventHandler(OnTitleChanged);
textview5.Buffer.Changed += new EventHandler(OnDescChanged);
combobox1.Changed += new EventHandler(OnPrivacyChanged);
combobox2.Changed += new EventHandler(OnLicenseChanged);
entry4.Changed += new EventHandler(OnBlogTitleChanged);
textview7.Buffer.Changed += new EventHandler(OnBlogDescChanged);
textview3.Buffer.Changed += new EventHandler(OnTagsChanged);
TextTag texttag = new TextTag("conflict");
texttag.Font = "Times Italic 10";
texttag.WrapMode = WrapMode.Word;
texttag.ForegroundGdk = new Gdk.Color(0x99, 0, 0);
textview4.Buffer.TagTable.Add(texttag);
// Showing photos should be the last step.
this._selectedphotos = selectedphotos;
if (selectedphotos.Count == 1) {
checkbutton1.Sensitive = false;
ShowInformationForCurrentPhoto();
//.........这里部分代码省略.........