Class IProjectItemExtensions
Provides extensions for the IProjectItem interface.
Inherited Members
Namespace: Loehnert.Lisrt.Scripting.ProjectItem.Project
Assembly: Loehnert.Lisrt.Scripting.dll
Syntax
public static class IProjectItemExtensions
Methods
GetAllProjectItems(IProjectItem)
Gets all descendants project items. Includes itself.
Declaration
public static IEnumerable<IProjectItem> GetAllProjectItems(this IProjectItem item)
Parameters
Type | Name | Description |
---|---|---|
IProjectItem | item | Item with sub items. |
Returns
Type | Description |
---|---|
IEnumerable<IProjectItem> | All sub project items and itself or just itself if it isn't an ICompositeProjectItem. |
Remarks
Uses ICompositeProjectItem interface to get sub items.
GetFullPath(IProjectItem)
Gets the absolute path of a IProjectItem implantation.
Declaration
public static string GetFullPath(this IProjectItem item)
Parameters
Type | Name | Description |
---|---|---|
IProjectItem | item | An IProjectItem with an IProject as root parent. |
Returns
Type | Description |
---|---|
String | The absolute path for the item, including the item name. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
System.InvalidOperationException | Thrown when |
GetRootProjectItem(IProjectItem)
Gets the root project item (normally an IProject).
Declaration
public static IProjectItem GetRootProjectItem(this IProjectItem item)
Parameters
Type | Name | Description |
---|---|---|
IProjectItem | item | A child project item. |
Returns
Type | Description |
---|---|
IProjectItem | The root project item. |
TryGetProjectItem(IProjectItem, String, out IProjectItem)
Tries to get the sub project item by relative path.
Declaration
public static bool TryGetProjectItem(this IProjectItem parentItem, string relativePath, out IProjectItem item)
Parameters
Type | Name | Description |
---|---|---|
IProjectItem | parentItem | Project item as root for the relative path. |
String | relativePath | Path to a project item. |
IProjectItem | item | Project item from the relative path. |
Returns
Type | Description |
---|---|
Boolean | True, if relative path was found. Otherwise false. |
Remarks
A path could be 'Folder\TextFile.txt' System.IO.Path.DirectorySeparatorChar or System.String.Empty as relative path returns the item itself.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |