The following is the vb.net code i need equilant C# code. can anybody pls help me to complete the following
If
Thanks in advancesai
plsaiuser wrote: Dim vaResultSet
Dim vaResultSet
I'm not too sure what you're doing here, but maybe it's something like this.
Object vaResultSet = new Object();
plsaiuser wrote: If Not IsArray(vaResultSet) Then
If Not IsArray(vaResultSet) Then
This can be done using something like this.
Type at = typeof(vaResultSet);if (!at.IsArray) {
plsaiuser wrote: ReDim vaResultSet(0)
ReDim vaResultSet(0)
This is somewhat interesting. ReDim resizes the object to an array of 0. It's pretty difficult to do this unless vaResultSet has been declared an array first. I would suggest that the 1st line when declaring vaResultSet be an array instead. Or assign it to another variable and return the array instead. So I would do something like this.
Before the if-else statement, I'll declare an array variable first.
Object[] myArray;
Then for the ReDim itself,
myArray = new Object[1];
myArray[0] = vaResultSet;
plsaiuser wrote:Else ReDim Preserve vaResultSet(UBound(vaResultSet) + 1)
Else
ReDim Preserve vaResultSet(UBound(vaResultSet) + 1)
This is also pretty interesting to do. In C# you won't be able to resize the object, so you'll have to create another new object to do so.
myObject = new Object(varResultSet.Length) + 1);Array.Copy(myObject, varResultSet, varResultSet.Length);
plsaiuser wrote: End If that should do the trick. You can replace Object with any type u require. I'm just assuming here. Regards, triplez ------------------------------ http://triplez.mine.nu/blogs
plsaiuser wrote: End If
End If
Use this: http://www.carlosag.net/Tools/CodeTranslator/Default.aspx and you will get this:
object vaResultSet;if (!IsArray(vaResultSet)) { object vaResultSet;}else { object Preserve; vaResultSet((UBound(vaResultSet) + 1));}
~Softwaremaker (BLOG) M. Twain: "I didn't have time to write a short letter, so I wrote a long one instead"
Hi plsaiuser,
Even though it is not equivalent(identical) translation, it will be better if you can rewrite the coding by using ArrayList.
Softwaremaker wrote:Use this: http://www.carlosag.net/Tools/CodeTranslator/Default.aspx and you will get this: object vaResultSet;if (!IsArray(vaResultSet)) { object vaResultSet;}else { object Preserve; vaResultSet((UBound(vaResultSet) + 1));}