converting vb.net code to c#
-
Hi, can anyone help me converting vb.net code given below into c#. also, if i have .dll project, how do i convert the .dll executable at the same time.. i appreciate ur help. Thanks... vb.net code ------------- Private Function GetSingleProperty(ByRef sElementName As String) As String Dim vValues As Object vValues = g_pPropSet.GetProperty(sElementName) If IsNothing(vValues) Then GetSingleProperty = "" ElseIf VarType(vValues(LBound(vValues))) <> VariantType.String Then GetSingleProperty = "" Else GetSingleProperty = vValues(LBound(vValues)) End If End Function vijju
-
Hi, can anyone help me converting vb.net code given below into c#. also, if i have .dll project, how do i convert the .dll executable at the same time.. i appreciate ur help. Thanks... vb.net code ------------- Private Function GetSingleProperty(ByRef sElementName As String) As String Dim vValues As Object vValues = g_pPropSet.GetProperty(sElementName) If IsNothing(vValues) Then GetSingleProperty = "" ElseIf VarType(vValues(LBound(vValues))) <> VariantType.String Then GetSingleProperty = "" Else GetSingleProperty = vValues(LBound(vValues)) End If End Function vijju
Why bother? Are you forgetting that all managed languages compile down to Intermediate Language? The source language doesn't matter; the associated compilers compiles that to IL and assemblies it in a module, which then gets embedded into an assembly along with embedded resources (if any). So why bother redoing it in C#? Just have your C# project reference the VB.NET assembly and viola'! The BCL (base class library) assemblies are written in C#, but you can use them in VB.NET, MC++, J#, and all the other languages, can't you?
Microsoft MVP, Visual C# My Articles