本文整理汇总了C#中SPFieldCollection.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# SPFieldCollection.Contains方法的具体用法?C# SPFieldCollection.Contains怎么用?C# SPFieldCollection.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SPFieldCollection
的用法示例。
在下文中一共展示了SPFieldCollection.Contains方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryGetField
public SPField TryGetField(SPFieldCollection siteColumns, Guid fieldID)
{
siteColumns.RequireNotNull("siteColumns");
fieldID.Require(Guid.Empty != fieldID, "fieldID");
return siteColumns.Contains(fieldID) ? siteColumns[fieldID] : null;
}
示例2: GetFieldById
/// <summary>
/// Gets the field by identifier.
/// Returns null if the field is not found in the collection.
/// </summary>
/// <param name="fieldCollection">The field collection.</param>
/// <param name="fieldId">The field identifier.</param>
/// <returns>The SPField.</returns>
public SPField GetFieldById(SPFieldCollection fieldCollection, Guid fieldId)
{
if (fieldCollection == null)
{
throw new ArgumentNullException("fieldCollection");
}
if (fieldId == null)
{
throw new ArgumentNullException("fieldId");
}
SPField field = null;
if (fieldCollection.Contains(fieldId))
{
field = fieldCollection[fieldId] as SPField;
}
return field;
}
示例3: FieldExists
private bool FieldExists(SPFieldCollection fieldCollection, string displayName, Guid fieldId)
{
if (fieldCollection.Contains(fieldId))
{
// If Id is found in the collection.
this._logger.Warn("Field with id '{0}' is already in the collection.", fieldId);
return true;
}
SPField field;
try
{
// Throws argument exception if not in collection.
field = fieldCollection.GetField(displayName);
}
catch (ArgumentException)
{
return false;
}
if (field == null)
{
// Still can't find the field in the collection
return false;
}
else
{
// We found it!
this._logger.Warn("Field with display name '{0}' is already in the collection.", displayName);
return true;
}
}
示例4: IsIn
public bool IsIn(SPFieldCollection fieldCollection)
{
return (ID != System.Guid.Empty && fieldCollection.Contains(ID)) ||
(!string.IsNullOrEmpty(Name) && fieldCollection.ContainsField(Name));
}
示例5: GetField
public virtual SPField GetField(SPFieldCollection fieldCollection, Guid fieldId)
{
if (fieldCollection.Contains(fieldId))
{
return fieldCollection[fieldId];
}
else
{
return null;
}
}
示例6: ContainsField
public virtual bool ContainsField(SPFieldCollection fieldCollection, Guid fieldId)
{
return fieldCollection.Contains(fieldId);
}