
# IComponentInfo interface

The `IComponentInfo` interface is an item within the [`ILibCompInfoReader`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/ILibCompInfoReader.md) interface. This `IComponentInfo` interface represents a schematic symbol in a specified schematic library file with a SchLib extension.

```csharp
public interface IComponentInfo
```

**Namespace:** SCH · **Assembly:** Altium.SDK.Interfaces

**Derived:** [IComponentFullInfo](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/IComponentFullInfo.md)

## Remarks

The steps required to load a schematic library and its components.

1. Create an object and pass in the filename of a schematic library file. This object is represented by the [`ILibCompInfoReader`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/ILibCompInfoReader.md) interface by [`ISch_ServerInterface.CreateLibCompInfoReader`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/ISch_ServerInterface.md#createlibcompinforeader).

2. Invoke the [`ILibCompInfoReader.ReadAllComponentInfo`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/ILibCompInfoReader.md#readallcomponentinfo) method to load the library and its components.

3. Invoke the [`ILibCompInfoReader.NumComponentInfos`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/ILibCompInfoReader.md#numcomponentinfos) method to obtain the number of components for this library

4. Obtain the indexed ComponentInfos method. This ComponentInfos method returns the indexed `IComponentInfo` interface.

The `IComponentInfo` interface is extracted from the ILibCompInfoReader.ComponentInfos method.

## Example

List the name, alias, part count, description and offset of each component in a schematic library.

```csharp
using System.Collections.Generic;
using System.IO;
using DXP;
using SCH;

ISch_ServerInterface schServer = SCH.GlobalVars.SchServer;
ISch_Document currentLib = schServer?.GetCurrentSchDocument();
if (currentLib == null)
    return;
string fileName = currentLib.GetState_DocumentName();
ILibCompInfoReader aLibCompReader = schServer.CreateLibCompInfoReader(fileName);
aLibCompReader.ReadAllComponentInfo();
var reportInfo = new List<string>();

// Obtain the number of components in the specified schematic library.
int compNum = aLibCompReader.NumComponentInfos();
// Go through each component obtained by the library component reader.
for (int j = 0; j < compNum; j++)
{
    reportInfo.Add(fileName);
    IComponentInfo compInfo = aLibCompReader.GetState_ComponentInfo(j);
    reportInfo.Add(" Name : " + compInfo.GetState_CompName());
    reportInfo.Add(" Alias Name : " + compInfo.GetState_AliasName());
    reportInfo.Add(" Part Count : " + compInfo.GetState_PartCount());
    reportInfo.Add(" Description : " + compInfo.GetState_Description());
    reportInfo.Add(" Offset : " + compInfo.GetState_Offset());
    reportInfo.Add("");
}

string reportPath = Path.Combine(Path.GetTempPath(), "SchLibCompReport.txt");
File.WriteAllLines(reportPath, reportInfo);
IClient client = DXP.GlobalVars.Client;
IServerDocument reportDocument = client.OpenDocument("Text", reportPath);
if (reportDocument != null)
    client.ShowDocument(reportDocument);
```

## Properties

| Property | Type | Access | Description |
| --- | --- | --- | --- |
| [AliasName](#aliasname) | `string` | get | This property returns the alias name for this component. |
| [CompName](#compname) | `string` | get | This property returns the name string for this component from the `IComponentInfo` object interface. |
| [Description](#description) | `string` | get | This property returns the description string for this component from the `IComponentInfo` object interface. |
| [Offset](#offset) | `int` | get | This property returns the offset as a number – each part of a component whole has an offset to denote its place within the component. |
| [PartCount](#partcount) | `int` | get | This method obtains the number of parts (multiple types of the same component type as an example). |

### AliasName

This property returns the alias name for this component. Ie a component can be referred to by one of its multiple names.

```csharp
string GetState_AliasName();
```

**Type:** `string` · **Access:** read-only

### CompName

This property returns the name string for this component from the `IComponentInfo` object interface.

```csharp
string GetState_CompName();
```

**Type:** `string` · **Access:** read-only

### Description

This property returns the description string for this component from the `IComponentInfo` object interface.

```csharp
string GetState_Description();
```

**Type:** `string` · **Access:** read-only

### Offset

This property returns the offset as a number – each part of a component whole has an offset to denote its place within the component.

```csharp
int GetState_Offset();
```

**Type:** `int` · **Access:** read-only

### PartCount

This method obtains the number of parts (multiple types of the same component type as an example). For example an Integrated circuit may have multiple smaller modules, such as a 74LS00 has multiple OR gates.

```csharp
int GetState_PartCount();
```

**Type:** `int` · **Access:** read-only

## Methods

| Method | Returns | Description |
| --- | --- | --- |
| [GetPartName](#getpartname) | `string` |  |

### GetPartName

*No description yet.*

```csharp
string GetPartName(int argPartNumber);
```

| Parameter | Type | Passing |
| --- | --- | --- |
| `argPartNumber` | `int` | value |

**Returns:** `string`

## Returned by

[ILibCompInfoReader.ComponentInfo](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/ILibCompInfoReader.md#componentinfo)
