Welcome to thinktecture forums
Sign in
|
Join
|
Faq
Discussion
Started by dimam at 12-04-2007 6:45 PM. Topic has 0 replies.
thinktecture fo...
»
WSCF
»
Discussion
»
Null vs. Empty String issue
Search
Sort Posts:
Oldest to newest
Newest to oldest
12-04-2007, 6:45 PM
dimam
Joined on 12-04-2007
Posts 1
Null vs. Empty String issue
Hello,
When the datacontract code is generated with the "Public property" option enabled, you get a code similar to this (for each attribute of a datacontract):
<System.Xml.Serialization.XmlAttributeAttribute(AttributeName:="ProcessCorrelationID")> _
Public Property ProcessCorrelationID() As String
Get
Return Me._processCorrelationID
End Get
Set
If (Me._processCorrelationID <> value) Then
Me._processCorrelationID = value
End If
End Set
End Property
Now, if I want to set an empty string ("") to the
ProcessCorrelationID
property, it will not get set as the
"If (Me._processCorrelationID <> value) Then
"
statement returns
false
when the
_processCorrelationID
is Nothing.
Well, I can write the following code to get around this and set the
ProcessCorrelationID
value to an empty string:
var.ProcessCorrelationID = "foo"
var.ProcessCorrelationID = ""
But this code just does not look right. Are there other workarounds? Is there a way you could fix this issue?
I am also curious, why do you need the "if" statement anyway? Wouldn't this work as well?
Set(ByVal value As String)
Me.lockingMachineField = Value
End Set
Thanks!
Dima
Report
thinktecture fo...
»
WSCF
»
Discussion
»
Null vs. Empty String issue
(please select)
Forums Home
|- Search Forums
|- Active Topics
|- Unanswered Posts
User Options
|- Sign In
|- Join this community
|- Forgot Password
WSCF
|- Discussion
|- Feature Requests
|- Announcements
DynWsLib
|- Discussion
© 2002 - 2006 by thinktecture, Ingo Rammer and Christian Weyer. All rights reserved.