directcast Questions

11

Solved

Does C# have an equivalent to VB.NET's DirectCast? I am aware that it has () casts and the 'as' keyword, but those line up to CType and TryCast. To be clear, these keywords do the following; CType/...
Concretize asked 21/4, 2010 at 14:32

3

Solved

I am an experienced C/C++/C# programmer who has just gotten into VB.NET. I generally use CType (and CInt, CBool, CStr) for casts because it is fewer characters and was the first way of casting whic...
Cacoepy asked 16/6, 2010 at 19:27

2

Solved

I always thought DirectCast() was fairly inexpensive, perforance- and memory-wise, and saw it basically as a way of helping me with IntelliSense, e.g. in event handlers: Public Sub myObject_EventH...
Ageless asked 20/4, 2015 at 13:51

4

Solved

Ever since I moved from VB6 to VB.NET somewhere in 2005, I've been using CType to do casting from one data type to another. I do this because it is simply faster to type, used to exist in VB6 and I...
Delayedaction asked 24/4, 2010 at 7:14

1

Solved

Public Enum Fruit Red_Apple = 1 Oranges Ripe_Banana End Enum Private Sub InitCombosRegular() Dim d1 As New Dictionary(Of Int16, String) For Each e In [Enum].GetValues(GetType(Fruit)) d1.Add(...
Argyll asked 13/10, 2009 at 18:49
1

© 2022 - 2024 — McMap. All rights reserved.