public override object GetRealSPObject() { if (realObject != null) { return(realObject); } object parentObj = base.ParentNode.SPObject; if (parentObj != null) { if (parentObj is ContentTypeCollection) { ContentTypeCollection contentTypes = parentObj as ContentTypeCollection; if (contentTypes.Any(c => c.Name == this.Title)) { realObject = contentTypes.FirstOrDefault(c => c.Name == this.Title); return(realObject); } } } return(null); }
private ContentType GetContentType(ContentTypeCollection contentTypes, string contentTypeName) { ContentType content = null; if (contentTypes == null || contentTypes.Count <= 0 || string.IsNullOrEmpty(contentTypeName)) { return(content); } return(contentTypes.FirstOrDefault(x => x.Name.Equals(contentTypeName))); }
private ContentType GetContentType(ContentTypeCollection collection, string contentTypeName = "") { contentTypeName = string.IsNullOrEmpty(contentTypeName) ? contentTypeName : Name; return(collection.FirstOrDefault(x => x.Name.Equals(contentTypeName))); }