Byte Array Property

I have the following

    Set(ByVal value As Byte())
            If Not _mergeDocument.SequenceEqual(value) Then
                _mergeDocument = value
                If Not Loading Then
                    Validate("MergeDocument")
                End If
            End If
        End Set

The problem is when a value is first assigned I get an error saying first cannot be null
rocky050371Asked:
Who is Participating?
 
CodeCruiserConnect With a Mentor Commented:
Oh yeah. Try this



Set(ByVal value As Byte())
     
            If IsNothing(_MergeDocument) Then
                _mergeDocument = value
            Else If Not _mergeDocument.SequenceEqual(value) Then
                _mergeDocument = value
                If Not Loading Then
                    Validate("MergeDocument")
                End If
            End If
        End Set
0
 
CodeCruiserCommented:
Change to


Set(ByVal value As Byte())
            If Not IsNothing(_MergeDocument) AndAlso _mergeDocument.SequenceEqual(value) Then
                _mergeDocument = value
                If Not Loading Then
                    Validate("MergeDocument")
                End If
            End If
        End Set
0
 
rocky050371Author Commented:
I am not sure that will work, the value by default is nothing, therefore when it is something it needs to be set
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.