本文整理汇总了C#中Collection.Single方法的典型用法代码示例。如果您正苦于以下问题:C# Collection.Single方法的具体用法?C# Collection.Single怎么用?C# Collection.Single使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Collection
的用法示例。
在下文中一共展示了Collection.Single方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveAttribute
private void RemoveAttribute( Collection<CustomAttribute> customAttributes )
{
var extattr = customAttributes.Single( x => x.AttributeType == _attributeToStrip );
customAttributes.Remove( extattr );
}
示例2: VerifyCreatePremiumDb
private static Services.Server.Database[] VerifyCreatePremiumDb(Collection<PSObject> newPremiumP1DatabaseResult, string databaseName, string serviceObjectiveId)
{
Services.Server.Database[] databases = new Services.Server.Database[] { newPremiumP1DatabaseResult.Single().BaseObject as Services.Server.Database };
Assert.AreEqual(1, databases.Length, "Expecting one database");
Assert.IsNotNull(databases[0], "Expecting a Database object.");
Assert.AreEqual(databases[0].Name, databaseName, string.Format("Expecting Database Name:{0}, actual is:{1}", databaseName, databases[0].Name));
Assert.AreEqual("Premium", databases[0].Edition);
Assert.AreEqual(databases[0].AssignedServiceObjectiveId, Guid.Parse(serviceObjectiveId), string.Format("Expecting Database Edition:{0}, actual is:{1}", serviceObjectiveId, databases[0].AssignedServiceObjectiveId));
Assert.AreEqual("SQL_Latin1_General_CP1_CI_AS", databases[0].CollationName);
return databases;
}
示例3: VerifyCreatePremiumDb
private static Database[] VerifyCreatePremiumDb(Collection<PSObject> newPremiumP1DatabaseResult, string databaseName, string serviceObjectiveId)
{
Database[] databases = new Database[] { newPremiumP1DatabaseResult.Single().BaseObject as Database };
Assert.AreEqual(1, databases.Length, "Expecting one database");
Assert.IsNotNull(databases[0], "Expecting a Database object.");
Assert.AreEqual(databases[0].Name, databaseName, string.Format("Expecting Database Name:{0}, actual is:{1}", databaseName, databases[0].Name));
/* SQL Server: Defect 1655888: When creating a premium database,
* the immediate returned value do not have valid Edition and Max Database Size info
* We should active the following asserts once the defect is fixed.
Assert.AreEqual("Premium", databases[0].Edition);
Assert.AreEqual(10, databases[0].MaxSizeGB);
Assert.AreEqual(databases[0].AssignedServiceObjectiveId, serviceObjectiveId, string.Format("Expecting Database Edition:{0}, actual is:{1}", serviceObjectiveId, databases[0].AssignedServiceObjectiveId));
*/
Assert.AreEqual("SQL_Latin1_General_CP1_CI_AS", databases[0].CollationName);
return databases;
}