本文整理汇总了C#中List.IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C# List.IsEmpty方法的具体用法?C# List.IsEmpty怎么用?C# List.IsEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类List
的用法示例。
在下文中一共展示了List.IsEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SubmitReport
public void SubmitReport(HandlingReport handlingReport)
{
IList<string> errors = new List<string>();
DateTime? completionTime = HandlingReportParser.ParseCompletionTime(handlingReport, errors);
VoyageNumber voyageNumber = HandlingReportParser.ParseVoyageNumber(handlingReport.VoyageNumber, errors);
HandlingType type = HandlingReportParser.ParseEventType(handlingReport.Type, errors);
UnLocode unLocode = HandlingReportParser.ParseUnLocode(handlingReport.UnLocode, errors);
foreach (string trackingIdStr in handlingReport.TrackingIds)
{
TrackingId trackingId = HandlingReportParser.ParseTrackingId(trackingIdStr, errors);
if (errors.IsEmpty())
{
DateTime registrationTime = DateTime.Now;
var attempt = new HandlingEventRegistrationAttempt(
registrationTime, completionTime.Value, trackingId, voyageNumber, type, unLocode);
applicationEvents.ReceivedHandlingEventRegistrationAttempt(attempt);
}
else
{
string errorString = String.Join("\r\n", errors.ToArray());
logger.Error("Parse error in handling report: " + errorString);
throw new FaultException<HandlingReportException>(new HandlingReportException(errorString), new FaultReason(errorString));
}
}
}
示例2: IsEmptyTest_IEnumerable
public void IsEmptyTest_IEnumerable()
{
List<int> source = new List<int>();
Assert.True(source.IsEmpty());
source.Add(1);
Assert.False(source.IsEmpty());
}
示例3: SelectListByTenantCodes
public IList<EMVehicleGroup> SelectListByTenantCodes(List<string> tenantCodes)
{
IList<EMVehicleGroup> list = null;
if (tenantCodes.IsEmpty())
return list;
string cmdText = string.Format("SELECT GroupID,GroupName,ParentGroupID,TenantCode,Remark FROM movo_vehiclegroup WHERE TenantCode in('{0}') order by GroupName", tenantCodes.JoinToString<string>("','"));
using (var dr = MySqlDB.GetDataReader(CommandType.Text, cmdText))
{
if (dr != null)
{
list = new List<EMVehicleGroup>();
while (dr.Read())
{
list.Add(new EMVehicleGroup
{
GroupID = dr.GetULong(0),
GroupName = dr.GetStringExt(1),
ParentGroupID = dr.GetULongNull(2),
TenantCode = dr.GetStringExt(3),
Remark = dr.GetStringExt(4)
});
}
dr.Close();
}
}
return list;
}
示例4: GetPropertyMatches
public List<PropertyMatch> GetPropertyMatches(List<PropertyMatchCriteria> propertyMatchCriteria)
{
var propertyMatches = new List<PropertyMatch>();
foreach (var criterion in propertyMatchCriteria)
{
var date = new DateTime();
DateTime.TryParse(criterion.DateCreated, out date);
var newApplications =
_propertyCaselistRepository.GetApplicationsWhereRequirementsMatchProperty(
criterion.Area, criterion.Beds, criterion.Price,
criterion.PropertyReference, date);
foreach (var application in newApplications)
{
application.GeneratePropertyCaselistStatus(_propertyCaselistStatusGenererator, criterion.PropertyReference);
}
propertyMatches.Add(new PropertyMatch
{
Applications = newApplications.ToList(),
Property = new Property
{
PropertyReference = criterion.PropertyReference
}
});
}
if(propertyMatches.IsNull() || propertyMatches.IsEmpty())
return new List<PropertyMatch>();
return propertyMatches;
}
示例5: Matches
public override bool Matches(object actual)
{
this.actual = actual;
_failures = new List<Failure>();
PropertyEquals(_expectedResponse, actual, _expectedResponse.GetType().Name);
return _failures.IsEmpty();
}
示例6: OrderTotal
public string OrderTotal(List<OrderDetail> orderDetails)
{
var total = 0m;
if (!orderDetails.IsEmpty())
total += orderDetails.Sum(item => item.Quantity * item.UnitPrice);
return FormatHelpers.Instance.Money(total);
}
示例7: BuildOrderClause
private void BuildOrderClause(StringBuilder queryBuilder, List<IOrderingMapper> orderingParts)
{
if (orderingParts.IsEmpty()) return;
var orderBldr = new StringBuilder(Environment.NewLine + "order by");
orderingParts.ForEach(part => orderBldr.Append(part.OrderClause));
queryBuilder.Append(orderBldr.ToString().TrimEnd(','));
}
示例8: Think
public void Think()
{
// lists of islands by player
// start of by only looking for non owned islands, later we could prioritize weaker targets
var ownedIslands = new List<IslandData> ();
var enemyIslands = new List<IslandData> ();
foreach (var island in Registry.Islands.Values)
{
var islandData = island.GetComponent<IslandData>();
if (islandData.PlayerData.uid != playerData.uid)
enemyIslands.Add(islandData);
else
ownedIslands.Add(islandData);
}
// Debug.Log (enemyIslands.Count + " enemies vs owned " + ownedIslands.Count);
// ai wins
if (enemyIslands.Count == 0)
{
GameObject.Find("Menu").GetComponent<Menu>().ShowLoseScreen();
}
// player wins
if (ownedIslands.Count == 0)
{
GameObject.Find("Menu").GetComponent<Menu>().ShowWinScreen();
}
// no enemies or owning no islands do nothing
if (enemyIslands.IsEmpty () || ownedIslands.IsEmpty ())
{
fsm.SendEvent("Idle");
return;
}
// use boost
// defend
// attack
MoveUnitsTo(ownedIslands.GetRandom().gameObject, enemyIslands.GetRandom ().gameObject);
fsm.SendEvent("Attack");
// Debug.Log("enemy island: " + islandData.PlayerData.uid + " != " + playerData.uid);
}
示例9: LoadFicheSalon
/// <summary>
/// Permet de charger la fiche de plusieurs salons
/// </summary>
/// <param name="salons">List{Salon}</param>
/// <returns>bool</returns>
public bool LoadFicheSalon(List<Salon> salons = null)
{
try
{
if (salons.IsEmpty()) return false;
foreach (var salon in salons)
LoadFicheSalon(salon);
return true;
}
catch (Exception)
{
return false;
}
}
示例10: FinalizeBindingConcrete
void FinalizeBindingConcrete(DiContainer container, List<Type> concreteTypes)
{
if (concreteTypes.IsEmpty())
{
// This can be common when using convention based bindings
return;
}
switch (BindInfo.Scope)
{
case ScopeTypes.Singleton:
{
RegisterProvidersForAllContractsPerConcreteType(
container,
concreteTypes,
(_, concreteType) => container.SingletonProviderCreator.CreateProviderStandard(
new StandardSingletonDeclaration(
concreteType,
BindInfo.ConcreteIdentifier,
BindInfo.Arguments,
_singletonType,
_singletonSpecificId),
_providerFactory));
break;
}
case ScopeTypes.Transient:
{
RegisterProvidersForAllContractsPerConcreteType(
container, concreteTypes, _providerFactory);
break;
}
case ScopeTypes.Cached:
{
RegisterProvidersForAllContractsPerConcreteType(
container,
concreteTypes,
(_, concreteType) =>
new CachedProvider(
_providerFactory(container, concreteType)));
break;
}
default:
{
throw Assert.CreateException();
}
}
}
示例11: CreateSubContainer
public DiContainer CreateSubContainer(List<TypeValuePair> args)
{
Assert.That(args.IsEmpty());
var prefab = _prefabProvider.GetPrefab();
var gameObject = _container.InstantiatePrefab(
prefab, new object[0], _groupName);
if (_gameObjectName != null)
{
gameObject.name = _gameObjectName;
}
var context = gameObject.GetComponent<GameObjectContext>();
Assert.IsNotNull(context,
"Expected prefab with name '{0}' to container a component of type 'GameObjectContext'", prefab.name);
return context.Container;
}
示例12: SearchActivity
public ActionResult SearchActivity( string searchTxt)
{
var account = _readOnlyRepository.First<Account>(x => x.EMail == User.Identity.Name);
var lista = new List<ActividadesModel>();
foreach (var story in account.History)
{
if (story.Actividad.Contains(searchTxt))
{
lista.Add(Mapper.Map<Actividades,ActividadesModel>(story));
}
}
if (lista.IsEmpty())
{
var model = new ActividadesModel();
model.Actividad = "No se encontro nada con esa busqueda";
model.Hora = DateTime.Now;
lista.Add(model );
}
return View(lista);
}
示例13: SelectVehicleByCodeList
/// <summary>
/// 根据车辆编码列表获取车辆的信息列表(不带分页)
/// </summary>
/// <param name="codeList">车辆编码列表</param>
/// <returns></returns>
public List<EMVehicle> SelectVehicleByCodeList(List<Guid> codeList)
{
List<EMVehicle> list = new List<EMVehicle>();
if (codeList.IsEmpty())
return list;
string sCmdText = string.Format(@"SELECT VehicleCode,LicenceNumber,GroupID,GPSTypeID,DeviceNo,SIMNo,GPSCode,TenantCode,InitMileage,ExpireTime,InstallTime,IsStop,CreateTime,IconType,GPSTypeName
FROM movo_vehicle WHERE VehicleCode in ('{0}') order by LicenceNumber asc ", codeList.JoinToString<Guid>("','"));
using (MySqlDataReader sdr = MySqlDB.GetDataReader(CommandType.Text, sCmdText))
{
if (sdr != null)
{
while (sdr.Read())
{
list.Add(new EMVehicle
{
VehicleCode = sdr.GetGuid(0),
LicenceNumber = sdr.GetStringExt(1),
GroupID = sdr.GetUInt64(2),
GPSTypeID = sdr.GetUInt64(3),
DeviceNo = sdr.GetStringExt(4),
SIMNo = sdr.GetStringExt(5),
GPSCode = sdr.GetStringExt(6),
TenantCode = sdr.GetStringExt(7),
InitMileage = sdr.GetDecimal(8),
ExpireTime = sdr.GetDateTimeNull(9),
InstallTime = sdr.GetDateTime(10),
IsStop = sdr.GetShort(11) == 1,
CreateTime = sdr.GetDateTime(12),
IconType = (EnumVehicleType)sdr.GetInt16(13),
GPSTypeName = sdr.GetStringExt(14)
});
}
sdr.Close();
}
}
return list;
}
示例14: PerformAction
public IEnumerable<ActionPerformError> PerformAction(Gamer gamer)
{
var errors = new List<ActionPerformError>();
foreach (var constraint in QtyBasedConstraints)
{
var result = constraint.GetResult(gamer);
if (!result)
{
errors.Add(new ActionPerformError(constraint.Description));
}
}
if (errors.IsEmpty())
{
foreach (var trigger in TriggersToCall)
{
trigger.CallOnGamer(gamer);
}
}
return errors;
}
示例15: Write
/// <summary>
/// Writes all stylesheet source.
/// </summary>
/// <param name="writer">The writer.</param>
protected virtual void Write(TextWriter writer)
{
IList<string> mergedList = new List<string>();
bool isSecured = ViewContext.HttpContext.Request.IsSecureConnection;
bool canCompress = ViewContext.HttpContext.Request.CanCompress();
Action<WebAssetItemCollection> append = assets =>
{
IList<string> result = AssetMerger.Merge("text/css", AssetHandlerPath, isSecured, canCompress, assets);
if (!result.IsNullOrEmpty())
{
mergedList.AddRange(result);
}
};
if (!StyleSheets.IsEmpty())
{
append(StyleSheets);
}
if (!mergedList.IsEmpty())
{
foreach (string stylesheet in mergedList)
{
writer.WriteLine("<link type=\"text/css\" href=\"{0}\" rel=\"stylesheet\"/>".FormatWith(stylesheet));
}
}
}