Microsoft MVP성태의 닷넷 이야기
Property 재정의가 가능한가요?? [링크 복사], [링크+제목 복사],
조회: 13220
글쓴 사람
주낙현 (dblab97 at korea.com)
홈페이지
첨부 파일
 

안녕하세요..
이부분은 VB.NET으로 프로퍼티가 여러 개 정의가 가능한걸로 알고 있습니다.. 혹시 C#에서도 가능하지 알고 싶습니다.
혹시 가능하다면... 간단한 예제좀 부탁합니다..
(예제 : VB.NET)
 Public Property Item(ByVal Index As Integer) As SessionItem
        Get
            Return CType(Me.List(Index), SessionItem)
        End Get
        Set(ByVal value As SessionItem)
            Me.List(Index) = value
        End Set
    End Property

    Public Property Item(ByVal oSessionItem As SessionItem) As SessionItem
        Get
            Return CType(List(List.IndexOf(oSessionItem)), SessionItem)
        End Get
        Set(ByVal value As SessionItem)
            List(List.IndexOf(oSessionItem)) = value
        End Set
    End Property

    Public ReadOnly Property Item(ByVal oTag As String)
        Get
            For Each oSessionItem As SessionItem In Me
                If oSessionItem.Tag = oTag Then
                    Return oSessionItem
                End If
            Next

            Return Nothing
        End Get
    End Property









[최초 등록일: ]
[최종 수정일: 12/5/2006]


비밀번호

댓글 작성자
 



2006-12-11 09시13분
예. C# 에서도 그와 같은 문법을 지원합니다. 보니까 VB.NET 과도 거의 1:1로 매칭이 되는 것 같군요. 위의 문법을 그대로 C# 으로 옮기시면 될 겁니다. ^^ (기억으로는 .NET 2.0 부터 지원하지요. 아마.)
kevin25

NoWriterDateCnt.TitleFile(s)