本文整理汇总了C#中ImmutableList.Head方法的典型用法代码示例。如果您正苦于以下问题:C# ImmutableList.Head方法的具体用法?C# ImmutableList.Head怎么用?C# ImmutableList.Head使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImmutableList
的用法示例。
在下文中一共展示了ImmutableList.Head方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParserError
public ParserError(string expected, ImmutableList<ParserChar> input, string message = "")
{
Message = message;
Expected = expected;
Input = input;
if (input.IsEmpty)
{
Location = SrcLoc.EndOfSource;
}
else
{
Location = input.Head().Location;
}
}
示例2: FirstSeedNodeProcess
public FirstSeedNodeProcess(ImmutableList<Address> seeds)
{
_cluster = Cluster.Get(Context.System);
_selfAddress = _cluster.SelfAddress;
if (seeds.Count <= 1 || seeds.Head() != _selfAddress)
throw new ArgumentException("Join seed node should not be done");
_remainingSeeds = seeds.Remove(_selfAddress);
_timeout = Deadline.Now + _cluster.Settings.SeedNodeTimeout;
_retryTaskToken = Context.System.Scheduler.ScheduleTellRepeatedlyCancelable(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1), Self, new InternalClusterAction.JoinSeenNode(), Self);
Self.Tell(new InternalClusterAction.JoinSeenNode());
}
示例3: JoinSeedNodes
public void JoinSeedNodes(ImmutableList<Address> seedNodes)
{
if (seedNodes.Any())
{
StopSeedNodeProcess();
if (seedNodes.SequenceEqual(ImmutableList.Create(_cluster.SelfAddress)))
{
Self.Tell(new ClusterUserAction.JoinTo(_cluster.SelfAddress));
_seedNodeProcess = null;
}
else
{
// use unique name of this actor, stopSeedNodeProcess doesn't wait for termination
_seedNodeProcessCounter += 1;
if (seedNodes.Head().Equals(_cluster.SelfAddress))
{
_seedNodeProcess = Context.ActorOf(Props.Create(() => new FirstSeedNodeProcess(seedNodes)), "firstSeedNodeProcess-" + _seedNodeProcessCounter);
}
else
{
_seedNodeProcess = Context.ActorOf(Props.Create(() => new JoinSeedNodeProcess(seedNodes)).WithDispatcher(_cluster.Settings.UseDispatcher), "joinSeedNodeProcess-" + _seedNodeProcessCounter);
}
}
}
}
示例4: JoinSeedNodeProcess
public JoinSeedNodeProcess(ImmutableList<Address> seeds)
{
_selfAddress = Cluster.Get(Context.System).SelfAddress;
_seeds = seeds;
if (!seeds.Any() || seeds.Head() == _selfAddress)
throw new ArgumentException("Join seed node should not be done");
Context.SetReceiveTimeout(Cluster.Get(Context.System).Settings.SeedNodeTimeout);
}