Actually no. The original local variable is declared:
private int _lastChangedBy = 0;
The property itself looks conventional.
However I should explain that the overall application is written using CSLA
2.1.4 and the programmer who wrote it just left on a long vacation without
leaving a scrap of documentation. Then management told me to translate it
using whatever freeware I could find. I barely knew CSLA existed before this
week. I love this job.
(Let me make a guess here. In the original C#, the class itself is declared
public class AccountInfo : Csla.BusinessBase<AccountInfo>
Could this have something to do with the ability of C# to test for nulls
with an integer property in this situation? But this won't translate to VB?)
"Family Tree Mike" wrote:
I guess that you have in c# a nullable int delclared: int? LastChangedBy
If so, then the property in vb should be declared as: Nullable(Of Integer)
"B. Chernick" wrote:
I have a little problem I'm not clear on. I program mostly in VB, I am
somewhat familiar with C#, and I've been told to translate a program. I was
under the general impression that since C# and VB are both Dot Net languages,
it was more or less possible to directly translate everything, aside from a
few individual language quirks.
In the original C# I have the following:
foreach (AccountInfo item in Accounts)
{
if (item.LastChangedBy != null)
{
... do some stuff here.
}
}
where LastChangedBy is an integer property of the object AccountInfo
My freeware translator has rendered this in VB as:
For Each item As AccountInfo In Accounts
If item.LastChangedBy IsNot Nothing Then
VS does not like this and gives an error: 'IsNot' requires operands that
have reference types, but this operand has the value type 'Integer'.
How would you translate this?