# AddU2Item

#### int AddU2Item(int lMsgId, ushort\[] pnValue)

메시지 작성시 U2 데이터를 원하는 길이만큼 추가 해 주는 함수.

Parameters

<table data-header-hidden><thead><tr><th width="182" valign="top"></th><th width="140" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Name</td><td valign="top">Type</td><td valign="top">Description</td></tr><tr><td valign="top">lMsgId</td><td valign="top">int</td><td valign="top">작성중인 메시지의 고유 ID</td></tr><tr><td valign="top">pnValue</td><td valign="top">ushort[]</td><td valign="top">참조할 U2데이터의 배열값</td></tr></tbody></table>

```csharp
// 케이스 2: U2 배열 데이터 추가 (예: 각 유닛별 상태 코드 모음)
    ushort[] uDataArray = new ushort[] { 1000, 2000, 3000, 4000 };
    int nResult2 = m_gem.AddU2Item(lMsgId, uDataArray);

    if (nResult2 == 0)
    {
        Console.WriteLine("U2 배열 아이템 추가 성공");
    }
    else
    {
        // 실패 시 반환 코드 확인
        Console.WriteLine($"아이템 추가 실패. 반환 코드: {nResult2}");
    }
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nviasoft.gitbook.io/nviasoft-docs/api-reference/item/addu2item/addu2item-1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
