本文整理汇总了C#中System.Collections.ObjectModel.Collection类的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.ObjectModel.Collection类的具体用法?C# System.Collections.ObjectModel.Collection怎么用?C# System.Collections.ObjectModel.Collection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
System.Collections.ObjectModel.Collection类属于命名空间,在下文中一共展示了System.Collections.ObjectModel.Collection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DropboxFileSystem
public DropboxFileSystem (Session session)
{
this.session = session;
sharedClient = new RestClient (session);
UserId = session.UserIds.FirstOrDefault () ?? "Unknown";
FileExtensions = new System.Collections.ObjectModel.Collection<string> ();
}
示例2: TestAlbersProjection
public void TestAlbersProjection()
{
CoordinateSystemFactory cFac = new SharpMap.CoordinateSystems.CoordinateSystemFactory();
IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Clarke 1866", 6378206.4, 294.9786982138982, LinearUnit.USSurveyFoot);
IHorizontalDatum datum = cFac.CreateHorizontalDatum("Clarke 1866", DatumType.HD_Geocentric, ellipsoid, null);
IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Clarke 1866", AngularUnit.Degrees, datum,
PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East),
new AxisInfo("Lat", AxisOrientationEnum.North));
//System.Collections.ObjectModel.Collection<ProjectionParameter> parameters = new System.Collections.ObjectModel.Collection<ProjectionParameter>(5);
System.Collections.ObjectModel.Collection<ProjectionParameter> parameters = new System.Collections.ObjectModel.Collection<ProjectionParameter>();
parameters.Add(new ProjectionParameter("central_meridian", -96));
parameters.Add(new ProjectionParameter("latitude_of_origin", 23));
parameters.Add(new ProjectionParameter("standard_parallel_1", 29.5));
parameters.Add(new ProjectionParameter("standard_parallel_2", 45.5));
parameters.Add(new ProjectionParameter("false_easting", 0));
parameters.Add(new ProjectionParameter("false_northing", 0));
IProjection projection = cFac.CreateProjection("Albers Conical Equal Area", "albers", parameters);
IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("Albers Conical Equal Area", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North));
ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys);
SharpMap.Geometries.Point pGeo = new SharpMap.Geometries.Point(-75, 35);
SharpMap.Geometries.Point pUtm = trans.MathTransform.Transform(pGeo);
SharpMap.Geometries.Point pGeo2 = trans.MathTransform.Inverse().Transform(pUtm);
SharpMap.Geometries.Point expected = new Point(1885472.7, 1535925);
Assert.IsTrue(ToleranceLessThan(pUtm, expected, 0.05), String.Format("Albers forward transformation outside tolerance, Expected {0}, got {1}", expected.ToString(), pUtm.ToString()));
Assert.IsTrue(ToleranceLessThan(pGeo, pGeo2, 0.0000001), String.Format("Albers reverse transformation outside tolerance, Expected {0}, got {1}", pGeo.ToString(), pGeo2.ToString()));
}
示例3: TestMercator_1SP_Projection
public void TestMercator_1SP_Projection()
{
CoordinateSystemFactory cFac = new SharpMap.CoordinateSystems.CoordinateSystemFactory();
IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Bessel 1840", 6377397.155, 299.15281, LinearUnit.Metre);
IHorizontalDatum datum = cFac.CreateHorizontalDatum("Bessel 1840", DatumType.HD_Geocentric, ellipsoid, null);
IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Bessel 1840", AngularUnit.Degrees, datum,
PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East),
new AxisInfo("Lat", AxisOrientationEnum.North));
//System.Collections.ObjectModel.Collection<ProjectionParameter> parameters = new System.Collections.ObjectModel.Collection<ProjectionParameter>(5);
System.Collections.ObjectModel.Collection<ProjectionParameter> parameters = new System.Collections.ObjectModel.Collection<ProjectionParameter>();
parameters.Add(new ProjectionParameter("latitude_of_origin", 0));
parameters.Add(new ProjectionParameter("central_meridian", 110));
parameters.Add(new ProjectionParameter("scale_factor", 0.997));
parameters.Add(new ProjectionParameter("false_easting", 3900000));
parameters.Add(new ProjectionParameter("false_northing", 900000));
IProjection projection = cFac.CreateProjection("Mercator_1SP", "Mercator_1SP", parameters);
IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("Makassar / NEIEZ", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North));
ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys);
SharpMap.Geometries.Point pGeo = new SharpMap.Geometries.Point(120, -3);
SharpMap.Geometries.Point pUtm = trans.MathTransform.Transform(pGeo);
SharpMap.Geometries.Point pGeo2 = trans.MathTransform.Inverse().Transform(pUtm);
SharpMap.Geometries.Point expected = new Point(5009726.58, 569150.82);
Assert.IsTrue(ToleranceLessThan(pUtm, expected, 0.02), String.Format("Mercator_1SP forward transformation outside tolerance, Expected {0}, got {1}", expected.ToString(), pUtm.ToString()));
Assert.IsTrue(ToleranceLessThan(pGeo, pGeo2, 0.0000001), String.Format("Mercator_1SP reverse transformation outside tolerance, Expected {0}, got {1}", pGeo.ToString(), pGeo2.ToString()));
}
示例4: initRuby
private void initRuby()
{
ScriptRuntimeSetup runtimeSetup = ScriptRuntimeSetup.ReadConfiguration();
var languageSetup = IronRuby.RubyHostingExtensions.AddRubySetup(runtimeSetup);
runtimeSetup.DebugMode = false;
runtimeSetup.PrivateBinding = false;
runtimeSetup.HostType = typeof(RhoHost);
languageSetup.Options["NoAdaptiveCompilation"] = false;
languageSetup.Options["CompilationThreshold"] = 0;
languageSetup.Options["Verbosity"] = 2;
m_runtime = IronRuby.Ruby.CreateRuntime(runtimeSetup);
m_engine = IronRuby.Ruby.GetEngine(m_runtime);
m_context = (RubyContext)Microsoft.Scripting.Hosting.Providers.HostingHelpers.GetLanguageContext(m_engine);
m_context.ObjectClass.SetConstant("RHO_WP7", 1);
m_context.Loader.LoadAssembly("RhoRubyLib", "rho.rubyext.rubyextLibraryInitializer", true, true);
System.Collections.ObjectModel.Collection<string> paths = new System.Collections.ObjectModel.Collection<string>();
paths.Add("lib");
paths.Add("apps/app");
m_engine.SetSearchPaths(paths);
}
示例5: InitializeView
/// <summary>
/// Initialises the view.
/// </summary>
/// <param name="grid">The layoutRoot grid.</param>
/// <param name="columnManager">Look ahead view column manager.</param>
public void InitializeView(Grid grid, ColumnManager columnManager)
{
System.Collections.ObjectModel.Collection<ColumnManager> columns = new System.Collections.ObjectModel.Collection<ColumnManager>();
columns.Add(columnManager);
this.view = new ColumnView(grid, columns, true);
}
示例6: getAssociations
public System.Collections.ObjectModel.Collection<UIElement> getAssociations()
{
System.Collections.ObjectModel.Collection<UIElement> asses = new System.Collections.ObjectModel.Collection<UIElement>();
if ((this.Child as StackPanel).Children.Count > 1)
{
Canvas assocCanvas = null;
foreach (UIElement u in (this.Child as StackPanel).Children)
if (u is Canvas)
{
assocCanvas = u as Canvas;
break;
}
if (assocCanvas != null)
{
foreach (UIElement u in assocCanvas.Children)
{
if ((u as VisualElement).Content is UMLAssociation)
{
asses.Add(u);
//((u as VisualElement).Content as UMLAssociation).drawArrow(new Point(0, 0), new Point(300, 300));
//Canvas.SetTop((u as VisualElement), 30);
//Canvas.SetLeft((u as VisualElement), 5);
//Canvas.SetZIndex(u, 6);
}
}
}
}
return asses;
}
示例7: TestPrm_FilterDescriptionContains_Descending
public void TestPrm_FilterDescriptionContains_Descending()
{
System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> coll =
new System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject>();
coll.Add(new System.Management.Automation.PSObject("test result`r`n%% 1"));
coll.Add(new System.Management.Automation.PSObject("test result`r`n%% 3"));
CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual(
@"$null = New-TMXTestSuite -Name 'suite%%`1 1'; " +
@"$null = Add-TMXTestScenario -Name 'scenario`r`n%% 1'; " +
@"$null = Add-TMXTestResultDetail -TestResultDetail 'detail 1'; " +
@"$null = New-TMXTestSuite -Name 'suite%%`2 2'; " +
@"$null = Add-TMXTestScenario -Name 'scenario`r`n%% 2'; " +
@"$null = Close-TMXTestResult -Name 'test result`r`n%% 1' -Description 'abc' -TestPassed; " +
@"$null = Add-TMXTestScenario -Name 'scenario`r`n%% 3'; " +
@"$null = Close-TMXTestResult -Name 'test result`r`n%% 2' -Id 01 -TestPassed; " +
@"$null = Add-TMXTestResultDetail -TestResultDetail 'detail 1'; " +
@"$null = New-TMXTestSuite -Name 'suite%%`3 3'; " +
@"$null = New-TMXTestSuite -Name 'suite%%`4 4'; " +
@"$null = Add-TMXTestScenario -Name 'scenario`r`n%% 4'; " +
@"$null = Add-TMXTestScenario -Name 'scenario`r`n%% 2'; " +
@"$null = New-TMXTestSuite -Name 'suite%%`5 5'; " +
@"$null = Close-TMXTestResult -Name 'test result`r`n%% 3' -Description 'cab' -TestPassed; " +
@"$null = Close-TMXTestResult -Name 'a' -Id '003' -Description 'ccc' -TestPassed; " +
@"Search-TMXTestResult -FilterDescriptionContains 'ab' -Descending | %{$_.Name;}",
coll);
}
示例8: TestPrm_Name_Complex_In_Series
public void TestPrm_Name_Complex_In_Series()
{
System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> coll =
new System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject>();
coll.Add(null);
coll.Add(new System.Management.Automation.PSObject("autoclosed"));
coll.Add(new System.Management.Automation.PSObject("test result`r`n%% 1"));
coll.Add(new System.Management.Automation.PSObject("test result`r`n%% 2"));
coll.Add(new System.Management.Automation.PSObject("test result`r`n%% 3"));
coll.Add(new System.Management.Automation.PSObject("autoclosed"));
CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual(
@"$null = New-TmxTestSuite -Name 'suite%%`1 1'; " +
@"$null = Add-TmxTestScenario -Name 'scenario`r`n%% 1'; " +
@"$null = Add-TmxTestResultDetail -TestResultDetail 'detail 1'; " +
@"$null = New-TmxTestSuite -Name 'suite%%`2 2'; " +
@"$null = Add-TmxTestScenario -Name 'scenario`r`n%% 2'; " +
@"$null = Close-TmxTestResult -Name 'test result`r`n%% 1' -TestPassed; " +
@"$null = Add-TmxTestScenario -Name 'scenario`r`n%% 3'; " +
@"$null = Close-TmxTestResult -Name 'test result`r`n%% 2' -TestPassed; " +
@"$null = Add-TmxTestResultDetail -TestResultDetail 'detail 1'; " +
@"$null = New-TmxTestSuite -Name 'suite%%`3 3'; " +
@"$null = New-TmxTestSuite -Name 'suite%%`4 4'; " +
@"$null = Add-TmxTestScenario -Name 'scenario`r`n%% 4'; " +
@"$null = Add-TmxTestScenario -Name 'scenario`r`n%% 2'; " +
@"$null = New-TmxTestSuite -Name 'suite%%`5 5'; " +
@"$null = Close-TmxTestResult -Name 'test result`r`n%% 3' -TestPassed; " +
@"Search-TmxTestResult -OrderById | %{$_.Name;}",
coll);
}
示例9: initRuby
private void initRuby()
{
ScriptRuntimeSetup runtimeSetup = ScriptRuntimeSetup.ReadConfiguration();
var languageSetup = IronRuby.RubyHostingExtensions.AddRubySetup(runtimeSetup);
runtimeSetup.DebugMode = false;
runtimeSetup.PrivateBinding = false;
runtimeSetup.HostType = typeof(RhoHost);
languageSetup.Options["NoAdaptiveCompilation"] = false;
languageSetup.Options["CompilationThreshold"] = 0;
languageSetup.Options["Verbosity"] = 2;
m_runtime = IronRuby.Ruby.CreateRuntime(runtimeSetup);
m_engine = IronRuby.Ruby.GetEngine(m_runtime);
m_context = (RubyContext)Microsoft.Scripting.Hosting.Providers.HostingHelpers.GetLanguageContext(m_engine);
m_context.ObjectClass.SetConstant("RHO_WP7", 1);
m_context.ObjectClass.AddMethod(m_context, "__rhoGetCallbackObject", new RubyLibraryMethodInfo(
new[] { LibraryOverload.Create(new Func<System.Object, System.Int32, System.Object>(RhoKernelOps.__rhoGetCallbackObject), false, 0, 0) },
RubyMethodVisibility.Public,
m_context.ObjectClass
));
m_context.Loader.LoadAssembly("RhoRubyLib", "rho.rubyext.rubyextLibraryInitializer", true, true);
System.Collections.ObjectModel.Collection<string> paths = new System.Collections.ObjectModel.Collection<string>();
paths.Add("lib");
paths.Add("apps/app");
m_engine.SetSearchPaths(paths);
}
示例10: TestPrm_Name_Simple_In_Series
public void TestPrm_Name_Simple_In_Series()
{
System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> coll =
new System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject>();
coll.Add(new System.Management.Automation.PSObject("scenario1"));
coll.Add(new System.Management.Automation.PSObject("scenario2"));
coll.Add(new System.Management.Automation.PSObject("scenario4"));
coll.Add(new System.Management.Automation.PSObject("scenario2"));
coll.Add(new System.Management.Automation.PSObject("scenario3"));
coll.Add(new System.Management.Automation.PSObject("scenario2"));
coll.Add(new System.Management.Automation.PSObject("scenario5"));
CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual(
@"$null = New-TmxTestSuite -Name suite1; " +
@"$null = Add-TmxTestScenario -Name scenario1; " +
@"$null = New-TmxTestSuite -Name suite2; " +
@"$null = New-TmxTestSuite -Name suite3; " +
@"$null = Add-TmxTestScenario -Name scenario2; " +
@"$null = Add-TmxTestScenario -Name scenario3; " +
@"$null = New-TmxTestSuite -Name suite4; " +
@"$null = Add-TmxTestScenario -Name scenario4; " +
@"$null = Add-TmxTestScenario -Name scenario2; " +
@"$null = Add-TmxTestScenario -Name scenario5; " +
@"$null = New-TmxTestSuite -Name suite5; " +
@"$null = Add-TmxTestScenario -Name scenario2; " +
@"Search-TmxTestScenario -OrderById | %{$_.Name;}",
coll);
}
示例11: IClient
public IClient(NetConnection conn, Game gameInstance)
: base(conn,gameInstance)
{
Que = new System.Collections.ObjectModel.Collection<qmsg>();
InternalQue = new System.Collections.ObjectModel.Collection<qmsg>();
Connection = conn;
WH = new System.Threading.AutoResetEvent(false);
}
示例12: Ancestors_1
private void Ancestors_1(string driverName)
{
System.Collections.ObjectModel.Collection<PSObject> coll =
new System.Collections.ObjectModel.Collection<PSObject>();
//coll.Add((new PSObject(" Value1\r\n Value 2\r\n Value \\3\r\n Value /4\r\n ")));
coll.Add((new PSObject("div3\r\nMy first paragraph.\r\nMy second paragraph.")));
coll.Add((new PSObject("div2\r\ndiv3\r\nMy first paragraph.\r\nMy second paragraph.")));
coll.Add((new PSObject("div1\r\ndiv2\r\ndiv3\r\nMy first paragraph.\r\nMy second paragraph.")));
coll.Add((new PSObject("My First Heading\r\ndiv1\r\ndiv2\r\ndiv3\r\nMy first paragraph.\r\nMy second paragraph.")));
coll.Add((new PSObject("My First Heading\r\ndiv1\r\ndiv2\r\ndiv3\r\nMy first paragraph.\r\nMy second paragraph.")));
// coll.Add((new PSObject("Test results 26.07.2012 16:16
// Value1
// Value 2
// Value \3
// Value /4
//
// Value1
// Value 2
// Value \3
// Value /4
//
// Value1
// Value 2
// Value \3
// Value /4
//
//Value1 Value 2 Value \3 Value /4
// Value1
// Value 2
// Value \3
// Value /4
//
//Value1 Value 2 Value \3 Value /4
//Suites:1 Passed:0 Failed:1 Not tested:0
//Scenarios:2 Passed:0 Failed:2 Not tested:0
//Test cases:21 Passed:11 Failed:7 Not tested:3 Time spent:6 seconds
//4 cases of non-critical issues are counted as Passed
//111 suite1 FAILED
//Scenarios:2 Passed:0 Failed:2 Not tested:0
//Test cases:21 Passed:11 Failed:7 Not tested:3 Time spent:6 seconds
//description description description description description description description description description description>
//)));
//coll.Add((new PSObject(Settings.TestFile05Controls1ElementSelect01Value03Name)));
//coll.Add((new PSObject(Settings.TestFile05Controls1ElementSelect01Value04Name)));
CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual(
@"Start-SeWebDriver -DriverName '" +
driverName +
@"' | Enter-SeURL -URL '" +
MiddleLevelCode.GetURLFromPath(System.IO.Path.GetFullPath(Settings.TestFile06Controls1)) +
@"' | Get-SeWebElement -XPath '" +
Settings.TestFile06Controls1Element01XPath +
//@"' | Get-SeWebElementAncestors | %{ $_ | Read-SeWebElementText; }",
@"' | Get-SeWebElementAncestors | Read-SeWebElementText;",
coll);
}
示例13: AddViews
private void AddViews()
{
//TODO: create the Module views, add them to the WorkItem and show them in
// a Workspace. See: ms-help://MS.VSCC.v80/MS.VSIPCC.v80/ms.practices.scsf.2007may/SCSF/html/03-01-040-How_to_Add_a_View_with_a_Presenter.htm
System.Collections.ObjectModel.Collection<string> cl = new System.Collections.ObjectModel.Collection<string>();
cl.Add(ACOT.Infrastructure.Interface.Constants.ModuleNames.ChkAddrModule);
cl.Add
if (OnModuleLoad != null)
OnModuleLoad(this, new EventArgs<System.Collections.ObjectModel.Collection<string>>(cl));
}
示例14: GetValues
private CascadingDropDownNameValue[] GetValues(System.Data.DataTable table)
{
System.Collections.ObjectModel.Collection<CascadingDropDownNameValue> values = new System.Collections.ObjectModel.Collection<CascadingDropDownNameValue>();
foreach(System.Data.DataRow dr in table.Rows)
{
values.Add(new CascadingDropDownNameValue(dr["party"].ToString(), dr["party_code"].ToString()));
}
return values.ToArray();
}
示例15: RunCommand
public System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> RunCommand(CmdletParameterSetBase paramSet, out System.Collections.ObjectModel.Collection<object> errors)
{
errors = new System.Collections.ObjectModel.Collection<object>();
System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> results = null;
System.Text.StringBuilder cmdString = new System.Text.StringBuilder(paramSet.Cmdlet);
System.Text.StringBuilder parameterValueClearScriptBuilder = new System.Text.StringBuilder();
foreach (CmdletParameterSwitchValuePair parameter in paramSet.Parameters)
{
if (parameter.Value != null && parameter.Value.IsSet)
{
if (parameter.Value is CmdletSwitchParameter)
{
cmdString.AppendFormat(" -{0}", parameter.ParameterSwitch);
}
else
{
string parameterSting = System.String.Empty, parameterGuidString;
switch (parameter.Value.ParameterValueType)
{
case ParameterValueTypeEnum.String:
parameterSting = (string)parameter.Value.ValueObject;
break;
case ParameterValueTypeEnum.Object:
parameterGuidString = System.Guid.NewGuid().ToString("N");
parameterSting = System.String.Format("${0}", parameterGuidString);
runspace.SessionStateProxy.SetVariable(parameterGuidString, parameter.Value.ValueObject);
parameterValueClearScriptBuilder.AppendLine(System.String.Format("{0} = $NULL", parameterSting));
break;
default:
System.Diagnostics.Debug.Assert(false, "Parameter object is not set properly. This error should never be seen.");
break;
}
cmdString.AppendFormat(" -{0} {1}", parameter.ParameterSwitch, parameterSting);
}
}
try
{
using (System.Management.Automation.Runspaces.Pipeline pipeline = runspace.CreatePipeline(cmdString.ToString()))
{
results = pipeline.Invoke();
errors = pipeline.Error.ReadToEnd();
}
}
finally
{
using (System.Management.Automation.Runspaces.Pipeline pipeline = runspace.CreatePipeline(parameterValueClearScriptBuilder.ToString()))
{
pipeline.Invoke();
}
}
}
return results;
}