本文整理汇总了C#中IReadOnlyDictionary类的典型用法代码示例。如果您正苦于以下问题:C# IReadOnlyDictionary类的具体用法?C# IReadOnlyDictionary怎么用?C# IReadOnlyDictionary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IReadOnlyDictionary类属于命名空间,在下文中一共展示了IReadOnlyDictionary类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Preset
public Preset(IEnumerable<KeyValuePair<string, string>> names, IReadOnlyDictionary<string,object> properties)
{
foreach (var lang in names)
PresetName[lang.Key] = lang.Value;
foreach (var prop in properties)
State[prop.Key] = prop.Value;
}
示例2: PipelineArgument
/// <summary>
/// Initializes a new instance of the <see cref="PipelineArgument"/> class.
/// </summary>
public PipelineArgument(IReadOnlyDictionary<string, string> propertyBag, IDocument document, IRuleSet rules, IPipelineMember successor)
{
PropertyBag = propertyBag;
Document = document;
Rules = rules;
Successor = successor;
}
示例3: GetContent
public override ContentItem GetContent(IReadOnlyDictionary<string, Argument> invocation, bool throwExceptionIfNotFound)
{
var uri = invocation["url"].AsUri();
var request = WebRequest.Create(uri);
request.UseDefaultCredentials = true;
var response = this.GetResponse(uri.AbsoluteUri, request);
var result = new ContentItem { ContentType = response.ContentType };
using (var stream = response.GetResponseStream())
{
if (stream == Stream.Null || stream == null)
{
if (throwExceptionIfNotFound)
{
throw new StoreItemNotFoundException(this.Name, uri.AbsoluteUri);
}
return null;
}
using (var reader = new StreamReader(stream))
{
result.Content = reader.ReadToEnd();
}
}
return result;
}
示例4: RedisEntity
public RedisEntity(RedisAccount account, BindingTemplate channelOrKeyPath, Mode mode, IReadOnlyDictionary<string, object> bindingData)
{
Account = account;
Mode = mode;
_channelOrKeyPath = channelOrKeyPath;
_bindingData = bindingData;
}
示例5: PossiblyConvertBody
static object PossiblyConvertBody(object messageBody, IReadOnlyDictionary<string, string> headers)
{
var legacySubscriptionMessage = messageBody as LegacySubscriptionMessage;
if (legacySubscriptionMessage == null)
{
return messageBody;
}
string returnAddress;
var topic = legacySubscriptionMessage.Type;
if (!headers.TryGetValue(Headers.ReturnAddress, out returnAddress))
{
throw new RebusApplicationException($"Got legacy subscription message but the '{Headers.ReturnAddress}' header was not present on it!");
}
var subscribe = legacySubscriptionMessage.Action == 0;
if (subscribe)
{
return new SubscribeRequest
{
Topic = topic,
SubscriberAddress = returnAddress
};
}
return new UnsubscribeRequest
{
Topic = topic,
SubscriberAddress = returnAddress
};
}
示例6: Activate
public async override Task Activate(INavigationService navigationService, NavigationContextBase navigationContext, IReadOnlyDictionary<string, object> pageState)
{
await base.Activate(navigationService, navigationContext, pageState);
MyNavigationContext context = navigationContext as MyNavigationContext;
if (pageState != null)
{
/*********************************************************
* If you store state on deactivation and it is provided
* here, you know that the user has used the back button
* or returned from app suspension and should restore state.
*********************************************************/
this.Value1 = pageState[nameof(this.Value1)] as string;
this.Value2 = pageState[nameof(this.Value2)] as string;
this.Value3 = pageState[nameof(this.Value3)] as string;
}
else if (context != null)
{
/*********************************************************
* Alternatively, if the user has navigated to the page
* for the first time, there won't be existing page state
* to restore. The context can be used to populate the page.
*********************************************************/
this.Value1 = context.Value1;
this.Value2 = context.Value2;
this.Value3 = context.Value3;
}
}
示例7: BindAddChild
public override PropertyTreeMetaObject BindAddChild(OperatorDefinition definition, IReadOnlyDictionary<string, PropertyTreeMetaObject> arguments)
{
var result = definition.Apply(null, component, arguments);
if (result == null)
return Null;
return CreateChild(result);
}
示例8: DownloadsScoreProvider
public DownloadsScoreProvider(IndexReader reader,
IReadOnlyDictionary<string, int[]> idMapping,
Downloads downloads,
RankingResult ranking,
QueryBoostingContext context,
double baseBoost)
: base(reader)
{
_idMapping = idMapping;
_downloads = downloads;
_baseBoost = baseBoost;
_ranking = ranking;
_context = context;
// We need the reader name: Lucene *may* have multiple segments (which are smaller indices)
// and RankingsHandler provides us with the per-segment document numbers.
//
// If no segments are present (small index) we use an empty string, which is what
// Lucene also uses internally.
var segmentReader = reader as SegmentReader;
_readerName = segmentReader != null
? segmentReader.SegmentName
: string.Empty;
}
示例9: CreateTableIfNotExists
internal static string CreateTableIfNotExists(string tableName, CreateFlags createFlags, IReadOnlyDictionary<string, ColumnMapping> columns)
{
bool fts3 = (createFlags & CreateFlags.FullTextSearch3) != 0;
bool fts4 = (createFlags & CreateFlags.FullTextSearch4) != 0;
bool fts = fts3 || fts4;
var @virtual = fts ? "VIRTUAL " : string.Empty;
var @using = fts3 ? "USING FTS3 " : fts4 ? "USING FTS4 " : string.Empty;
// Build query.
var query = "CREATE " + @virtual + "TABLE IF NOT EXISTS \"" + tableName + "\" " + @using + "(\n";
var decls = columns.Select(c => SQLBuilder.SqlDecl(c.Key, c.Value));
var decl = string.Join(",\n", decls.ToArray());
query += decl;
var fkconstraints =
string.Join(
",\n",
columns.Where(x => x.Value.ForeignKeyConstraint != null).Select(x =>
string.Format("FOREIGN KEY(\"{0}\") REFERENCES \"{1}\"(\"{2}\")",
x.Key,
x.Value.ForeignKeyConstraint.TableName,
x.Value.ForeignKeyConstraint.ColumnName)));
query += (fkconstraints.Length != 0) ? "," + fkconstraints : "";
query += ")";
return query;
}
示例10: LanguageServiceMetadata
public LanguageServiceMetadata(IDictionary<string, object> data)
: base(data)
{
this.ServiceType = (string)data.GetValueOrDefault("ServiceType");
this.Layer = (string)data.GetValueOrDefault("Layer");
this.Data = (IReadOnlyDictionary<string, object>)data;
}
示例11: CheckProperyType
public static bool CheckProperyType(IReadOnlyDictionary<string, string> data, KeyValuePair<string, string> param)
{
var result = true;
switch (param.Value)
{
case "Int32":
int number;
if (data.ContainsKey(param.Key))
result = int.TryParse(data[param.Key], out number);
break;
case "Guid":
Guid guid;
if (data.ContainsKey(param.Key))
result = Guid.TryParse(data[param.Key], out guid);
break;
case "DateTime":
DateTime dateTime;
if (data.ContainsKey(param.Key))
result = DateTime.TryParse(data[param.Key], out dateTime);
break;
}
return result;
}
示例12: Validate
public Task Validate(ParsedMutation mutation, IReadOnlyList<SignatureEvidence> authentication, IReadOnlyDictionary<AccountKey, AccountStatus> accounts)
{
if (this.alwaysValid)
return Task.FromResult(0);
else
throw new TransactionInvalidException("Disabled");
}
示例13: SetApplicationData
public void SetApplicationData(IReadOnlyDictionary<string, object> applicationData) {
// creating fake context is the only way to access HttpApplicationFactory.ApplicationState
var context = new HttpContext(new SimpleWorkerRequest("", "", new StringWriter()));
foreach (var pair in applicationData) {
context.Application[pair.Key] = pair.Value;
}
}
示例14: NpkDirDifferences
public NpkDirDifferences(IReadOnlyList<ImgInfo> imgsInFirstButNotSecond, IReadOnlyDictionary<NpkPath, FrameCountDifferenceInfo> imgsWithFewerFramesInSecond, IReadOnlyList<ImgInfo> imgsInSecondButNotFirst, IReadOnlyDictionary<NpkPath, FrameCountDifferenceInfo> imgsWithMoreFramesInSecond)
{
ImgsInFirstButNotSecond = imgsInFirstButNotSecond;
ImgsWithFewerFramesInSecond = imgsWithFewerFramesInSecond;
ImgsInSecondButNotFirst = imgsInSecondButNotFirst;
ImgsWithMoreFramesInSecond = imgsWithMoreFramesInSecond;
}
示例15: RootGuardianActorRef
public RootGuardianActorRef(ActorSystemImpl system, Props props, MessageDispatcher dispatcher, Func<Mailbox> createMailbox, //TODO: switch from Func<Mailbox> createMailbox to MailboxType mailboxType
IInternalActorRef supervisor, ActorPath path, IInternalActorRef deadLetters, IReadOnlyDictionary<string, IInternalActorRef> extraNames)
: base(system,props,dispatcher,createMailbox,supervisor,path)
{
_deadLetters = deadLetters;
_extraNames = extraNames;
}