本文整理汇总了C#中LinkedList.All方法的典型用法代码示例。如果您正苦于以下问题:C# LinkedList.All方法的具体用法?C# LinkedList.All怎么用?C# LinkedList.All使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinkedList
的用法示例。
在下文中一共展示了LinkedList.All方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LinkedListExtensions_All_ReturnsTrueIfLinkedListIsEmpty
public void LinkedListExtensions_All_ReturnsTrueIfLinkedListIsEmpty()
{
var list = new LinkedList<Int32>();
var result = list.All(x => x % 2 == 0);
TheResultingValue(result).ShouldBe(true);
}
示例2: LinkedListExtensions_All_ReturnsTrueIfAllItemsMatchPredicate
public void LinkedListExtensions_All_ReturnsTrueIfAllItemsMatchPredicate()
{
var list = new LinkedList<Int32>();
list.AddLast(2);
list.AddLast(4);
list.AddLast(6);
var result = list.All(x => x % 2 == 0);
TheResultingValue(result).ShouldBe(true);
}
示例3: LinkedListExtensions_All_ReturnsFalseIfOneItemDoesNotMatchPredicate
public void LinkedListExtensions_All_ReturnsFalseIfOneItemDoesNotMatchPredicate()
{
var list = new LinkedList<Int32>();
list.AddLast(1);
list.AddLast(2);
list.AddLast(4);
list.AddLast(6);
var result = list.All(x => x % 2 == 0);
TheResultingValue(result).ShouldBe(false);
}
示例4: Check
protected override void Check()
{
var components = Enumerable.Range(0, 5).Select(i => new C()).ToArray();
var model = TestModel.InitializeModel(components);
IFaultSetHeuristic heuristic = new MinimalRedundancyHeuristic(model,
components.Select(c => c.F1),
components.Select(c => c.F2),
components.Select(c => c.F3)
);
var setsToCheck = new LinkedList<FaultSet>();
heuristic.Augment(0, setsToCheck);
setsToCheck.Count.ShouldBe(125);
setsToCheck.All(set => set.Cardinality == 12).ShouldBe(true);
}
示例5: WindowShownOrActivated
private IntPtr WindowShownOrActivated(LinkedList<Tuple<Workspace, Window>> list)
{
var window = list.First.Value.Item2;
var activatedWindow = window.hWnd;
if (list.All(t => !t.Item1.IsCurrentWorkspace))
{
Workspace workspace;
if (monitors.Length > 1 &&
(workspace = list.Select(t => t.Item1).FirstOrDefault(ws => ws.IsWorkspaceVisible)) != null)
{
// the window is actually visible on another monitor
// (e.g. when the user has ALT-TABbed to the window across monitors)
if (justDeactivatedWindow)
{
// Windows is trying to activate a window from another workspace when some on the current one was
// destroyed or minimized. Do not allow that but instead reactivate another one from the current workspace
activatedWindow = DoForTopmostWindowForWorkspace(CurrentWorkspace, ActivateWindow);
}
else
{
SwitchToWorkspace(workspace.id, false);
}
}
else
{
switch (window.onHiddenWindowShownAction)
{
case OnWindowCreatedOrShownAction.SwitchToWindowsWorkspace:
SwitchToApplication(window.hWnd);
break;
case OnWindowCreatedOrShownAction.MoveWindowToCurrentWorkspace:
ChangeApplicationToWorkspace(window.hWnd, CurrentWorkspace.id, list.First.Value.Item1.id);
break;
case OnWindowCreatedOrShownAction.TemporarilyShowWindowOnCurrentWorkspace:
CurrentWorkspace.Monitor.temporarilyShownWindows.Add(window.hWnd);
break;
case OnWindowCreatedOrShownAction.HideWindow:
HideWindow(window);
activatedWindow = DoForTopmostWindowForWorkspace(CurrentWorkspace, ActivateWindow);
break;
}
}
}
return activatedWindow;
}
示例6: FindBestSequence
private int[] FindBestSequence()
{
var states = new LinkedList<ActivityState>(values.Select(
x => new ActivityState(x, E, 0)));
while (true)
{
var biggestUnset = states
.Where(x => x.AllocatedEnergy < x.AvailableEnergy)
.OrderByDescending(x => x.Value)
.FirstOrDefault();
if (biggestUnset == null) break;
// take the max we can
biggestUnset.AllocatedEnergy = biggestUnset.AvailableEnergy;
// propagate the change
var node = states.Find(biggestUnset);
PropagateConstrainBackward(node);
PropagateConstrainForward(node);
}
Debug.Assert(states.All(x=>x.AllocatedEnergy == x.AvailableEnergy));
return states.Select(x => x.AllocatedEnergy).ToArray();
}
示例7: SetObjectValue
public bool SetObjectValue(ModelDoc2 inModel, string inName, int inType, double inVal, bool noArtIfSuppressed = false)
{
object swObj;
Dimension swDim;
Feature swFeature;
Component2 swComp;
bool ret = false;
if (GetObjectByName(inModel, inName, inType, out swObj))
{
double dTestVal;
switch (inType)
{
case 14:
swDim = (Dimension)swObj;
dTestVal = swDim.GetSystemValue2("") * 1000;
if (dTestVal != inVal)
{
ret = (swDim.SetSystemValue2(inVal / 1000,
(int)
swSetValueInConfiguration_e.swSetValue_InAllConfigurations) ==
(int)swSetValueReturnStatus_e.swSetValue_Successful);
}
else
ret = true;
break;
case 22:
swFeature = (Feature)swObj;
dTestVal = (swFeature.IsSuppressed() ? 0 : 1);
if (dTestVal != inVal)
{
//ret = swFeature.SetSuppression(inVal == 0 ? (int) swFeatureSuppressionAction_e.swSuppressFeature : (int)swFeatureSuppressionAction_e.swUnSuppressFeature);
ret =
swFeature.SetSuppression2(
inVal == 0
? (int)swFeatureSuppressionAction_e.swSuppressFeature
: (int)swFeatureSuppressionAction_e.swUnSuppressFeature,
(int)swInConfigurationOpts_e.swAllConfiguration, inModel.GetConfigurationNames());
#region ������ ��������
Component2 newComp = null;
var config = inModel.IGetActiveConfiguration();
if (config != null)
{
swComp = config.IGetRootComponent2();
if (swComp != null)
{
var outComps = new LinkedList<Component2>();
if (GetComponents(swComp, outComps, false, false))
{
foreach (var component2 in outComps)
{
var mod = component2.IGetModelDoc();
if (mod != null)
{
var texture = component2.GetTexture("");
if (mod.GetType() == (int)swDocumentTypes_e.swDocPART &&
texture != null)
{
newComp = component2;
}
}
}
}
}
}
if (newComp != null)
{
inModel.Save();
if (newComp.Select(false))
((AssemblyDoc)inModel).ComponentReload();
}
#endregion
}
else
ret = true;
break;
case 20:
swComp = (Component2)swObj;
try
{
if ((swComp.IsSuppressed() ? 0 : 1) == inVal)
{
ret = true;
}
else
{
int k = inVal == 0
? (int)swComponentSuppressionState_e.swComponentSuppressed
: (int)swComponentSuppressionState_e.swComponentFullyResolved;
bool isCavity = false;
if (inVal == 0)
//.........这里部分代码省略.........
示例8: AllAtStart
private static bool AllAtStart( LinkedList<Agent> Agents )
{
return Agents.All( x => x.Location.Equals( x.Start ) );
}