Localization and Messaging Editor Search


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Yes, as we mentioned on another thread a while back, all new development will be in C#. There are a number of reasons, and VB.NET is a great language, but there are a number of things that C# does better and some things that can be done only in C# such as explicit and implicit casting such as creating a a root data type. For example, we will be introducing a root data type (like a string) in a future release that is money. It handles all of the rounding and casting issues one currently faces when dealing with money. In order to be properly implemented it has to be done in C#.



And if someone could convince Microsoft to turn off the run-time compiler on VB, that would eliminate a lot of other issues within the design-time environment...though ultimately we would still move over to C# for some of the other reasons mentioned.
Keith Chisarik
Keith Chisarik
StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
I missed that prior post. Thanks

Keith Chisarik
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
No problem...it was buried somewhere a while back.
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
OK, I give....what's a root data type? Ermm
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Well, technically implicit and explicit casting can be used for any class so you don't have to wrap it in a Ctype or a C# cast. A better way of putting this would be a structure. For example the money class I am talking about doesn't require an instance to be created and acts like a root type or a primitive type such as a string. For example:



Money myMoney = 0;




or in VB.NET



Dim myMoney As Money = 0




You can also implicity cast types without the need to wrap it in a cast, like this:



double var1 = 0.0;

Money var2 = 1;



var2 = var1;




Using the above example, you would have to cast it without the implicit casting which would look like this:



var2 = (Money)var1;




But the above code wouldn't work because there is no explicit casting on the Money so you would get the error saying that a Double could not be cast as Money. Make sense?

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Almost Wink



So, is a root type just a structure? Is there more to it? I know VB can do structures which can have methods (shared and instance) and properties (like the max value of ints). I'm just curious... Smile
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Correct. But the one thing you cannot do in VB has to do with an implicit or explicit operator conversion. For example, the below code is not possible in VB:





public static implicit operator double( Money m )

{

return m._value;

}

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Just wanted to clarify one thing on this as well, doing this type of conversion should only be used in rare circumstances...but this happened to be one of them. Smile
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I've been reading up on this and I'm not sure I'm seeing what C# can do that VB can't. In VB you can overload operators (+, -, >, <, etc.) including CType. So, in VB you could do:



Public Shared Widening Operator CType(m As Money) As Double

  '-- do approrpiate conversion...

End Operator



Public Shared Widening Operator CType(i As Integer) As Money

  '-- do approrpiate conversion...

End Operator



Public Shared Narrowing Operator CType(d As Double) As Money

  '-- do approrpiate conversion...

End Operator




I just created a sample app and I don't think there is any difference between VB and C# related to this. Narrowing conversion can be implicit, but widening conversions must make the conversion explicitly:





'-- This works because money has a Narrowing CType() operator

'   between integer and money

Dim m As Money = 34



'-- Likewise you could assigna money value to a double

Dim d As Double = m



'-- But if you wanted to do the reverse, you'd have to use

'   an explicit conversion

Dim m2 As Money = CType(234.5334, Money)




C# can't do narrowing conversions implicitly, can it? Am I missing something?



Thanks for taking the time to respond to this also, as I'm learning a lot. This is yet another reason SF and this forum rocks! BigGrin
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Yeah, I suppose that the Narrowing would be similar. In truth, didn't look too hard as we had already planned on moving away from VB.NET when we were doing this. So I guess this is one of those things that is good to know but in the scheme of things will not make any difference.



At this point I really don't feel the need to investigate it much more, but thanks for the info. Wink



I will say this...VB.NET really did a poor job of syntax naming! This is another reason...we have some new developers and they are taking to C# much faster than VB. We finally had to use C# code to make them understand that a "Friend" is an "internal"....for example. I will add this to the list of poor name choices. BigGrin



Really, had we cared to know, I suppose we could have gone the other way to look up the VB once we had made the C# work...but at that point it had no bearing.



Just FYI...C# will still be the new code base Wink
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search