Non posso usarlo. Los Strict On (non so cosa sia) mi stravolge parecchie istruzioni. Ad esempio conversioni da Char a String, ed anche altro... mi tirava fuori una sfilza di errori...

Quote Originariamente inviata da pietro09 Visualizza il messaggio
Quello di sotto è un esempio semplice. Di più non so.

codice:
Option Strict On
Imports l = libreria.ModuloWeb

Module Module1

    Sub Main(args As String())
        Dim lista As New List(Of Utenti)()
        lista.Add(New Utenti("Stefano", #1/1/2018#))
        lista.Add(New Utenti("Carlo", #1/1/2018#))
        lista.Add(New Utenti("Nicola", #1/1/2018#))
        lista.Add(New Utenti("Pietro", #1/1/2018#))
        lista.Sort()

        'For Each item As Utenti In lista
        '    Console.WriteLine(item.Nome)
        'Next

        ' < 0 => non trovato, altrimenti trova indice
        Dim o As Integer = lista.BinarySearch(New Utenti("pietro", Nothing))
        If o >= 0 Then
            Console.WriteLine("Trovato utente {1} in posizione {0}", o, lista(o).Nome)
        Else
            Console.WriteLine("Non ho trovato utente")
        End If


        Console.Write("Premere un tasto per continuare . . . ") : Console.ReadKey()
    End Sub


    Public Structure Utenti
        Implements IComparable(Of Utenti)

        Public Property Nome As String
        Public Property Data As DateTime

        Public Sub New(nome As String, data As DateTime)
            Me.Nome = nome
            Me.Data = data
        End Sub

        Public Function CompareTo(other As Utenti) As Integer Implements System.IComparable(Of Utenti).CompareTo
            Return String.Compare(Me.Nome, other.Nome, True)
        End Function
    End Structure

End Module