Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VB.net - Macro Substitution
Message
From
07/01/2011 13:59:30
 
 
To
07/01/2011 11:53:37
General information
Forum:
ASP.NET
Category:
LINQ
Environment versions
Environment:
VB 9.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01488984
Message ID:
01495181
Views:
70
Hi,

I don't think your extension method worked as intended. Try:
'ExtensionAttribute
<System.Runtime.CompilerServices.Extension()> _
    Public Function IncludesCode(ByVal sc As e_SecurityCodes, ByVal DocSecurityValue As e_SecurityCodes) As Boolean
         If sc.HasFlag(DocSecurityValue) Then
            Return True
        End If
        Return False
    End Function
Then for the Click:
Dim results As List(Of ListCol) = New List(Of ListCol)()

        Dim l1 As New ListCol()
        l1.Id = 1
        l1.SecurityCodes = e_SecurityCodes.DMS_Accounting_AP
        results.Add(l1)

        Dim l2 As New ListCol()
        l2.Id = 2
        l2.SecurityCodes = e_SecurityCodes.DMS_Accounting_AR
        results.Add(l2)

        Dim result_Match =
            (From x In results Where x.SecurityCodes.IncludesCode(e_SecurityCodes.DMS_Accounting_AP) Select x).ToList()
(I mocked your ListCol class like so):
Public Class ListCol
    Private _securityCodes
    Public Property SecurityCodes As e_SecurityCodes
        Get
            Return _securityCodes
        End Get
        Set(ByVal value As e_SecurityCodes)
            _securityCodes = value
        End Set
    End Property

    Private _id
    Public Property Id As Integer
        Get
            Return _id
        End Get
        Set(ByVal value As Integer)
            _id = value
        End Set
    End Property
End Class
Sorry if this doesn't solve the problem - done in a rush .....
Previous
Reply
Map
View

Click here to load this message in the networking platform