473,327 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Transfering structure from WebService

It's well known that IDictionary collections present run-time exceptions if
you attempt to serialize them across Web service boundaries.

I need transfer data from this struct:

private struct OnlineRecordData
{
public string WITS;
public float Value;
....
}

I use this technic to transfer data:

[WebMethod]
public List<stringOnlineRecord()
{
// data sample
OnlineRecordData[] a = new OnlineRecordData[100];
// populate a[] from database...

List<stringr = new List<string>();

for (int i = 0; i <= a.GetUpperBound(0); i++)
{
r.Add(a[i].WITS + "=" + a[i].Value.ToString("E"));
}
return r;
}

My question is: Is there is some way to write this more efficient code? ...
I need the best speed

Thanks in advanced,
<Harvey Triana />
Oct 27 '07 #1
4 2419
Harvey Triana wrote:
It's well known that IDictionary collections present run-time exceptions if
you attempt to serialize them across Web service boundaries.

I need transfer data from this struct:

private struct OnlineRecordData
{
public string WITS;
public float Value;
....
}

I use this technic to transfer data:

[WebMethod]
public List<stringOnlineRecord()
{
// data sample
OnlineRecordData[] a = new OnlineRecordData[100];
// populate a[] from database...

List<stringr = new List<string>();

for (int i = 0; i <= a.GetUpperBound(0); i++)
{
r.Add(a[i].WITS + "=" + a[i].Value.ToString("E"));
}
return r;
}

My question is: Is there is some way to write this more efficient code? ...
I need the best speed
The best solution from a object oriented and portability aspect would be
to return an array of your class.

In your code return a.

Just make OnlineRecordData serializable (and possible use private fields
and public properties).

Arne
Oct 27 '07 #2
Do you mean me that with BinaryFormatter is more efficient?

<Harvey Triana />
"Arne Vajhøj" <ar**@vajhoej.dkescribió en el mensaje
news:47***********************@news.sunsite.dk...
Harvey Triana wrote:
>It's well known that IDictionary collections present run-time exceptions
if you attempt to serialize them across Web service boundaries.

I need transfer data from this struct:

private struct OnlineRecordData
{
public string WITS;
public float Value;
....
}

I use this technic to transfer data:

[WebMethod]
public List<stringOnlineRecord()
{
// data sample
OnlineRecordData[] a = new OnlineRecordData[100];
// populate a[] from database...

List<stringr = new List<string>();

for (int i = 0; i <= a.GetUpperBound(0); i++)
{
r.Add(a[i].WITS + "=" + a[i].Value.ToString("E"));
}
return r;
}

My question is: Is there is some way to write this more efficient code?
... I need the best speed

The best solution from a object oriented and portability aspect would be
to return an array of your class.

In your code return a.

Just make OnlineRecordData serializable (and possible use private fields
and public properties).

Arne

Oct 29 '07 #3
Or, with SoapFormatter (i use WebServices) ... ?

<Harvey Triana />

"Harvey Triana" <ha**********@hotmail.comescribió en el mensaje
news:%2****************@TK2MSFTNGP05.phx.gbl...
Do you mean me that with BinaryFormatter is more efficient?

<Harvey Triana />
"Arne Vajhøj" <ar**@vajhoej.dkescribió en el mensaje
news:47***********************@news.sunsite.dk...
>Harvey Triana wrote:
>>It's well known that IDictionary collections present run-time exceptions
if you attempt to serialize them across Web service boundaries.

I need transfer data from this struct:

private struct OnlineRecordData
{
public string WITS;
public float Value;
....
}

I use this technic to transfer data:

[WebMethod]
public List<stringOnlineRecord()
{
// data sample
OnlineRecordData[] a = new OnlineRecordData[100];
// populate a[] from database...

List<stringr = new List<string>();

for (int i = 0; i <= a.GetUpperBound(0); i++)
{
r.Add(a[i].WITS + "=" + a[i].Value.ToString("E"));
}
return r;
}

My question is: Is there is some way to write this more efficient code?
... I need the best speed

The best solution from a object oriented and portability aspect would be
to return an array of your class.

In your code return a.

Just make OnlineRecordData serializable (and possible use private fields
and public properties).

Arne


Oct 29 '07 #4
Harvey Triana wrote:
Do you mean me that with BinaryFormatter is more efficient?
Binary is absolutely faster than SOAP XML.

But it would not be a real web service anymore.

Arne
Nov 3 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Douglas Buchanan | last post by:
Newbie to donnet This is an example of a structure given in vs.net help ============================ Private Structure Employee Public GivenName As String ' This employee's given name....
4
by: Murugavel | last post by:
Hi, We maintain a seperate server for files which are uploaded by the user(Clients). We run our site in Production server,we need to Keep our uploaded files in our file server. we use...
2
by: Niyazi | last post by:
Hi, I have BIG question and I gues it is the BEST question. I have a problem that I am guessing the best solution is to create some sort ..NET Services. This Service(s) must check every...
0
by: rgerla | last post by:
I'm trying to serialize a compount structure set for a web service, the sturctures are something like this: Public Structure UserPhone Public phonenumber As String Public phonetype As Char End...
0
by: rgerla | last post by:
I'm trying to serialize a compount structure set for a web service, the sturctures are something like this: Public Structure UserPhone Public phonenumber As String Public phonetype As Char End...
4
by: M. Posseth | last post by:
Does someone knows a easy way how to acomplsih the folowing i made a online catalogue with order basket the orders that i store in my database should be submitted to a other webserver...
3
by: Ren | last post by:
Hi all, I'm still rather new to .NET so I hope you'll bear with me as I try and explain my question. I am writing an ASP.NET application using VB.NET. I am accessing a web method from a...
7
by: sareel | last post by:
I need the explanation/code to transmit a complex datastructure like Linked list or binary tree using sockets from client to sever...
0
by: Islamegy® | last post by:
I was using WebService and i want to convert this WebService to Class Library so I Removed Inhertance and Attributes with no problems. But When i try to import Exist Dataset or TableAdapters i...
0
by: Ro | last post by:
I've been given the task of transfering data from an access db to sql server 2000. The previous access db was not structured very well so we reconstructed the tables in sql server 2000 to add...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.