本文整理汇总了C#中ObjectCollection类的典型用法代码示例。如果您正苦于以下问题:C# ObjectCollection类的具体用法?C# ObjectCollection怎么用?C# ObjectCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectCollection类属于命名空间,在下文中一共展示了ObjectCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Ctor_ExecuteBothOverloads_MatchExpectation
public void Ctor_ExecuteBothOverloads_MatchExpectation()
{
// Use default validator
ObjectCollection<string> c = new ObjectCollection<string>();
c.Add("value1");
c.Insert(0, "value2");
Assert.Throws<ArgumentNullException>(() => { c.Add(null); });
Assert.Throws<ArgumentNullException>(() => { c[0] = null; });
Assert.Equal(2, c.Count);
Assert.Equal("value2", c[0]);
Assert.Equal("value1", c[1]);
// Use custom validator
c = new ObjectCollection<string>(item =>
{
if (item == null)
{
throw new InvalidOperationException("custom");
}
});
c.Add("value1");
c[0] = "value2";
Assert.Throws<InvalidOperationException>(() => { c.Add(null); });
Assert.Throws<InvalidOperationException>(() => { c[0] = null; });
Assert.Equal(1, c.Count);
Assert.Equal("value2", c[0]);
}
开发者ID:noahfalk,项目名称:corefx,代码行数:33,代码来源:ObjectCollectionTest.cs
示例2: AreEqualCollections_UseSetOfNotEqualCollections_ReturnsFalse
public void AreEqualCollections_UseSetOfNotEqualCollections_ReturnsFalse()
{
ObjectCollection<NameValueHeaderValue> x = new ObjectCollection<NameValueHeaderValue>();
ObjectCollection<NameValueHeaderValue> y = new ObjectCollection<NameValueHeaderValue>();
Assert.True(HeaderUtilities.AreEqualCollections(x, y), "Expected '<empty>' == '<empty>'");
x.Add(new NameValueHeaderValue("a"));
x.Add(new NameValueHeaderValue("c"));
x.Add(new NameValueHeaderValue("b"));
x.Add(new NameValueHeaderValue("c"));
y.Add(new NameValueHeaderValue("a"));
y.Add(new NameValueHeaderValue("b"));
y.Add(new NameValueHeaderValue("c"));
y.Add(new NameValueHeaderValue("d"));
Assert.False(HeaderUtilities.AreEqualCollections(x, y));
Assert.False(HeaderUtilities.AreEqualCollections(y, x));
y.Clear();
y.Add(new NameValueHeaderValue("a"));
y.Add(new NameValueHeaderValue("b"));
y.Add(new NameValueHeaderValue("b"));
y.Add(new NameValueHeaderValue("c"));
Assert.False(HeaderUtilities.AreEqualCollections(x, y));
Assert.False(HeaderUtilities.AreEqualCollections(y, x));
}
开发者ID:noahfalk,项目名称:corefx,代码行数:29,代码来源:HeaderUtilitiesTest.cs
示例3: Start
void Start()
{
objectCollection = gameObject.GetComponent<ObjectCollection>();
stateList = new Dictionary<int, State>();
AddNewState();
activeState = stateList[0];
stateNumberDisplay.text = string.Format(CURRENT_STATE_TEXT, 0);
}
开发者ID:nus-mtp,项目名称:ar-design-tool,代码行数:8,代码来源:StateManager.cs
示例4: ScriptingExtension
public ScriptingExtension()
{
languages = new List<IScriptEngine>();
publishedMethods = new MethodCollection();
publishedObjects = new ObjectCollection();
PublishedMethods.Added += new TalkingCollectionEventHandler<string, Delegate>(HandleNewMethod);
PublishedMethods.Removed += new TalkingCollectionEventHandler<string, Delegate>(HandleRemoveMethod);
}
开发者ID:hapm,项目名称:IrcShark,代码行数:8,代码来源:ScriptingExtension.cs
示例5: Structure
protected Structure(ILocation orbiting, Corporation owner)
: base(orbiting)
{
Owner = owner;
this.ships = new ObjectCollection<Ship>(this);
this.personnel = new ObjectCollection<Agent>(this);
this.stores = new ItemCollection<IItem>();
}
开发者ID:andy-uq,项目名称:Echo,代码行数:9,代码来源:Structure.cs
示例6: State
public State(SerialState ss, ObjectCollection objectCollection)
{
stateObjects = new Dictionary<int, StateObject>();
grid = GameObject.FindGameObjectWithTag(GRID_TAG);
stateObjectButtonTemplate = (GameObject)Resources.Load(STATE_OBJECT_BUTTON_NAME);
name = ss.name;
id = ss.id;
InitializeStateObjects(ss, objectCollection);
}
开发者ID:nus-mtp,项目名称:ar-design-tool,代码行数:9,代码来源:State.cs
示例7: CreateWithValueTypes
public virtual void CreateWithValueTypes()
{
int[] sequence = new int[] { 1, 2, 3 };
ObjectCollection collection = new ObjectCollection(sequence);
Assert.AreEqual(sequence.Length, collection.Count, "Collection should be the same size as the sequence!");
for (int i = 0; i < sequence.Length; i++)
{
Assert.AreEqual(sequence[i], collection[i], "collection[{0}] does not match sequence[{0}]!", i);
}
}
开发者ID:modulexcite,项目名称:SilverlightToolkit,代码行数:10,代码来源:ObjectCollectionTest.cs
示例8: CreateWithReferenceTypes
public virtual void CreateWithReferenceTypes()
{
string[] sequence = new string[] { "Hello", "World" };
ObjectCollection collection = new ObjectCollection(sequence);
Assert.AreEqual(sequence.Length, collection.Count, "Collection should be the same size as the sequence!");
for (int i = 0; i < sequence.Length; i++)
{
Assert.AreEqual(sequence[i], collection[i], "collection[{0}] does not match sequence[{0}]!", i);
}
}
开发者ID:modulexcite,项目名称:SilverlightToolkit,代码行数:10,代码来源:ObjectCollectionTest.cs
示例9: DataGridViewComboBoxCell
public DataGridViewComboBoxCell () : base() {
autoComplete = true;
dataSource = null;
displayStyle = DataGridViewComboBoxDisplayStyle.DropDownButton;
displayStyleForCurrentCellOnly = false;
dropDownWidth = 1;
flatStyle = FlatStyle.Standard;
items = new ObjectCollection(this);
maxDropDownItems = 8;
sorted = false;
owningColumnTemlate = null;
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:12,代码来源:DataGridViewComboBoxCell.cs
示例10: ComboBox
public ComboBox ()
{
items = new ObjectCollection (this);
DropDownStyle = ComboBoxStyle.DropDown;
item_height = FontHeight + 2;
//background_color = ThemeEngine.Current.ColorWindow;
border_style = BorderStyle.None;
drop_down_height = default_drop_down_height;
flat_style = FlatStyle.Standard;
}
开发者ID:Clancey,项目名称:MonoMac.Windows.Form,代码行数:12,代码来源:ComboBox.cocoa.cs
示例11: PointSelector
public PointSelector()
{
markerChart.SetBinding(Panel.ZIndexProperty, new Binding("(Panel.ZIndex)") { Source = this });
// initializing built-in commands
removePointCommand = new LambdaCommand((param) => RemovePointExecute(param), RemovePointCanExecute);
changeModeCommand = new LambdaCommand((param) => ChangeModeExecute(param), ChangeModeCanExecute);
addPointCommand = new LambdaCommand((param) => AddPointExecute(param), AddPointCanExecute);
InitializeComponent();
// adding context menu binding to markers
markerChart.AddPropertyBinding(DefaultContextMenu.PlotterContextMenuProperty, data =>
{
ObjectCollection menuItems = new ObjectCollection();
MenuItem item = new MenuItem { Header = UIResources.PointSelector_RemovePoint, Command = PointSelectorCommands.RemovePoint, CommandTarget = this };
item.SetBinding(MenuItem.CommandParameterProperty, new Binding());
menuItems.Add(item);
return menuItems;
});
// loading marker template
var markerTemplate = (DataTemplate)Resources["markerTemplate"];
markerChart.MarkerBuilder = new TemplateMarkerGenerator(markerTemplate);
markerChart.ItemsSource = points;
// adding bindings to commands from PointSelectorCommands static class
CommandBinding removePointBinding = new CommandBinding(
PointSelectorCommands.RemovePoint,
RemovePointExecute,
RemovePointCanExecute
);
CommandBindings.Add(removePointBinding);
CommandBinding changeModeBinding = new CommandBinding(
PointSelectorCommands.ChangeMode,
ChangeModeExecute,
ChangeModeCanExecute);
CommandBindings.Add(changeModeBinding);
CommandBinding addPointBinding = new CommandBinding(
PointSelectorCommands.AddPoint,
AddPointExecute,
AddPointCanExecute);
CommandBindings.Add(addPointBinding);
// init add point menu item
addPointMenuItem.Click += addPointMenuItem_Click;
points.CollectionChanged += points_CollectionChanged;
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:53,代码来源:PointSelector.xaml.cs
示例12: Universe
public Universe()
{
this.syncRoot = new object();
this.factory = new ObjectFactory(this);
this.starClusters = new ObjectCollection<StarCluster>(this);
this.corporations = new ObjectCollection<Corporation>(this);
Location = this;
EventPump = new EventPump();
this.nextObjectID = 0;
EnsureObjectID();
}
开发者ID:andy-uq,项目名称:Echo,代码行数:14,代码来源:Universe.cs
示例13: GameMakerFile
public GameMakerFile()
{
Sprites = new SpriteCollection();
Sounds = new SoundCollection();
Backgrounds = new BackgroundCollection();
Paths = new PathCollection();
Scripts = new ScriptCollection();
Fonts = new FontCollection();
TimeLines = new TimeLineCollection();
Objects = new ObjectCollection();
Rooms = new RoomCollection();
Triggers = new TriggerCollection();
Includes = new IncludedFileCollection();
Constants = new ConstantCollection();
Information = new GameInformation();
Settings = new GameSettings();
ResourceTree = new ResourceTree();
}
开发者ID:snakedeveloper,项目名称:GMK-Assembler,代码行数:18,代码来源:GameMakerFile.cs
示例14: InitializeStateObjects
private void InitializeStateObjects(SerialState serialState, ObjectCollection objectCollection)
{
foreach (SerialStateObject s in serialState.stateObjects)
{
foreach (GameObject g in objectCollection.GetUserObjects())
{
if (g.name.Equals(s.modelName))
{
GameObject toSpawn = MonoBehaviour.Instantiate(g);
StateObject stateObject = new StateObject(toSpawn);
s.InitializeStateObject(stateObject);
AddToState(stateObject);
nextStateObjectId = Mathf.Max(s.id, nextStateObjectId);
Debug.Log(id + ", " +s.id);
break;
}
}
}
nextStateObjectId++;
}
开发者ID:nus-mtp,项目名称:ar-design-tool,代码行数:20,代码来源:State.cs
示例15: AreEqualCollections_UseSetOfEqualCollections_ReturnsTrue
public void AreEqualCollections_UseSetOfEqualCollections_ReturnsTrue()
{
ObjectCollection<NameValueHeaderValue> x = new ObjectCollection<NameValueHeaderValue>();
ObjectCollection<NameValueHeaderValue> y = new ObjectCollection<NameValueHeaderValue>();
Assert.True(HeaderUtilities.AreEqualCollections(x, y));
x.Add(new NameValueHeaderValue("a"));
x.Add(new NameValueHeaderValue("c"));
x.Add(new NameValueHeaderValue("b"));
x.Add(new NameValueHeaderValue("c"));
y.Add(new NameValueHeaderValue("c"));
y.Add(new NameValueHeaderValue("c"));
y.Add(new NameValueHeaderValue("b"));
y.Add(new NameValueHeaderValue("a"));
Assert.True(HeaderUtilities.AreEqualCollections(x, y));
Assert.True(HeaderUtilities.AreEqualCollections(y, x));
}
开发者ID:noahfalk,项目名称:corefx,代码行数:20,代码来源:HeaderUtilitiesTest.cs
示例16: select_OnPreSelect
void select_OnPreSelect(ref object PreSelectEntity, out bool DoHighlight, ref ObjectCollection MorePreSelectEntities, SelectionDeviceEnum SelectionDevice, Inventor.Point ModelPosition, Point2d ViewPosition, Inventor.View View)
{
DoHighlight = true;
//���õ������ѡ�Ķ�������ã�����ǰ�涨��Ĺ�����������֪���ö���һ����һ����
Edge edge;
edge = (Edge)PreSelectEntity;
//ȷ���Ƿ�����ñ����в����ӵı�
EdgeCollection edges;
edges = edge.TangentiallyConnectedEdges;
if (edges.Count > 1)
{
//�������������ߵĶ��
|
请发表评论