This is the VB code: formattedBlockList.AddRange(MDM_Ref.GetLatestReadingsByMeterListFormattedBlock(meterList.ToArray, startdate.AddSeconds(-1), enddate, interval, {""}, ""))
This is my C# code: formattedBlockList.AddRange(MDM_Ref.GetLatestReadingsByMeterListFormattedBlock(meterList.ToArray, startdate.AddSeconds(-1), enddate, interval, arr1, ""));
C# does not allow me to use {""} for the empty string array, so I created an empty string array arr1.
Here is the complete code:
public List
{
List
System.DateTime startdate = Convert.ToDateTime("05/01/2012");
System.DateTime enddate = Convert.ToDateTime("05/04/2012");
string interval ="D";
List
int i = 0;
int meter = 30000;
int lastMeter = 30000;
for (i = meter; i <= lastMeter; i++) {
meterList.Add(new meterID { meterNo = i.ToString() });
}
string[] arr1 = {""};
try {
formattedBlockList.AddRange(MDM_Ref.GetLatestReadingsByMeterListFormattedBlock(meterList.ToArray, startdate.AddSeconds(-1), enddate, interval, arr1, ""));
}
catch (Exception ex) {
}
return formattedBlockList;
}
Here is the web service:
public formattedBlock[] GetLatestReadingsByMeterListFormattedBlock(meterID[] meterIDs, System.DateTime startDate, System.DateTime endDate, string formattedBlockTemplateName, string[] fieldName, string lastReceived) {
object[] results = this.Invoke("GetLatestReadingsByMeterListFormattedBlock", new object[] {
meterIDs,
startDate,
endDate,
formattedBlockTemplateName,
fieldName,
lastReceived});
return ((formattedBlock[])(results[0]));
}
VulpesPosted Jun 7, 2012, 10:12 AM
meterList.ToArray
which I'd have thought should be in C#:
meterList.ToArray()
Candyce HegstromPosted Jun 7, 2012, 12:02 PM