Share via


defaultcollelem 특성

[defaultcollelem] 특성은 속성을 기본 컬렉션의 요소에 대한 접근자 함수로 플래그를 지정합니다.

[property-attribute-list, defaultcollelem] return-type property-name(prop-param-list)

매개 변수

property-attribute-list

속성에 적용되는 기타 특성입니다.

return-type

함수의 반환 형식을 지정합니다.

property-name

속성의 이름입니다.

prop-param-list

속성과 연결된 0개 이상의 매개 변수 목록입니다.

설명

[defaultcollelem] 특성은 Visual Basic® 코드 최적화에 사용됩니다. 인터페이스 또는 dispinterface의 멤버에 접근자 함수로 플래그가 지정되면 호출이 해당 멤버로 직접 이동합니다.

속성에 대해 [defaultcollelem] 을 사용해야 합니다. 예를 들어 Get 속성에서 특성을 사용하는 경우 Let 속성에도 있어야 합니다.

Typeflags 표현

FUNCFLAG_FDEFAULTCOLLELEM 또는 VARFLAG_FDEFAULTCOLLELEM 존재.

//A form has a button on it named Button1. 
//To enable use of the property syntax and efficient use of the !
//syntax, the form describes itself in type info this way.
[
    dual,
    uuid(12345678-1234-1234-1234-123456789ABC),
    helpstring("This is IForm"),
    restricted
]
interface IForm1: IForm
{
    [propget, defaultcollelem] HRESULT Button1(
        [out, retval] Button *Value);
}

//User code may access the button using property syntax or ! syntax.

Sub Test()
Dim f as Form1
Dim b1 As Button
Dim b2 As Button

Set f = Form1

Set b1 = f.Button1        ' Property syntax
Set b = f!Button1        ' ! syntax
End Sub

참고 항목

ODL 파일 구문

ODL 파일 예제

MIDL을 사용하여 형식 라이브러리 생성