/// <summary> /// For properties of type 'string[]', returns property items that may be converted to long as a long[]. /// </summary> public static long[] ToLongArray(this PropertyCompact property) { if ((property.Type ?? string.Empty) == PropertyTypes.STRING + PropertyTypes.LIST_SUFFIX) { return(property.Items.Select(i => i.ToLong()).Where(i => i.HasValue).Select(i => i.Value).ToArray()); } return(null); }
public static PropertyContentMap[] ToMapArray(this PropertyCompact property) { if ((property.Type ?? string.Empty) == PropertyTypes.MAP + PropertyTypes.LIST_SUFFIX) { return(property.Items.Select(i => i.ToMap()).Where(i => i != null).ToArray()); } return(null); }
/// <summary> /// For multi-value properties of type 'run[]', returns property items as RunCompact[] /// </summary> public static RunCompact[] ToRunsArray(this PropertyCompact property) { if ((property.Type ?? string.Empty) != PropertyTypes.RUN + PropertyTypes.LIST_SUFFIX) { return(null); } return(property.ToResourceArray <RunCompact>()); }
/// <summary> /// For multi-value properties of type 'appsession[]', returns property items as AppSessionCompact[] /// </summary> public static AppSessionCompact[] ToAppSessionArray(this PropertyCompact property) { if ((property.Type ?? string.Empty) != PropertyTypes.APPSESSION + PropertyTypes.LIST_SUFFIX) { return(null); } return(property.ToResourceArray <AppSessionCompact>()); }
/// <summary> /// For multi-value properties of type 'project[]', returns property items as ProjectCompact[] /// </summary> public static ProjectCompact[] ToProjectArray(this PropertyCompact property) { if ((property.Type ?? string.Empty) != PropertyTypes.PROJECT + PropertyTypes.LIST_SUFFIX) { return(null); } return(property.ToResourceArray <ProjectCompact>()); }
/// <summary> /// For multi-value properties of type 'appresult[]', returns property items as AppResultCompact[] /// </summary> public static AppResultCompact[] ToAppResultArray(this PropertyCompact property) { if ((property.Type ?? string.Empty) != PropertyTypes.APPRESULT + PropertyTypes.LIST_SUFFIX) { return(null); } return(property.ToResourceArray <AppResultCompact>()); }
/// <summary> /// For multi-value properties of type 'sample[]', returns property items as SampleCompact[] /// </summary> public static SampleCompact[] ToSampleArray(this PropertyCompact property) { if ((property.Type ?? string.Empty) != PropertyTypes.SAMPLE + PropertyTypes.LIST_SUFFIX) { return(null); } return(property.ToResourceArray <SampleCompact>()); }
/// <summary> /// For multi-value properties containing resource references, returns property items referencing the given type as an array /// </summary> public static TResourceType[] ToResourceArray <TResourceType>(this PropertyCompact property) where TResourceType : class, IPropertyContent { if (property.Items != null) { return(property.Items.Select(i => i.ToResource <TResourceType>()).Where(i => i != null).ToArray()); } return(null); }
/// <summary> /// Returns true if not all property items for the property have been returned in this request due to paging /// </summary> public static bool IsTruncated(this PropertyCompact property) { if (property.Content != null) { // single-value properties aren't truncated return(false); } return(property.ItemsDisplayedCount < property.ItemsTotalCount); }
public static bool TryGetProperty(this PropertyContainer propertyContainer, string name, out PropertyCompact property) { if (propertyContainer.Items == null) { property = null; return(false); } property = propertyContainer.Items.FirstOrDefault(p => p.Name == name); return(property != null); }
/// <summary> /// Returns the property's type for single-value properties, and the underlying type for multi-value properties. /// </summary> public static string GetUnderlyingType(this PropertyCompact property) { return((property.Type ?? string.Empty).Replace(PropertyTypes.LIST_SUFFIX, string.Empty)); }