I have created a function that returns a string containing raw HTML to
be used on a web form (see below):
private string GetReportHTML()
{
string strHTML = "";
// I have some code here that queries a database and
// formats the return DataSet as HTML and inserts
// this HTML into strHTML for return to the calling
// function
return strHTML;
}
This HTML content is a report. As such, there is potential for this
report, and thus the returned string size, to be very large.
My question is this, would there be any performance benefit by
changing this function from returning a string to accepting a "ref
string strHTML", considering this string could be very large? (see
below)
private void GetReportHTML(r ef strHTML)
{
}
Thanks in advance. 3 1748
Since the string type is a reference type, a reference to the string is
already returned from the GetReportHTML() method. Adding a parameter with
the ref keyword won't do anything for you. A ref param would only be used
if you wanted to change which object the parameter referred to, which is not
what you want to do in this case.
Joe
-- http://www.csharp-station.com
"Bob Maggio" <bc*****@yahoo. com> wrote in message
news:ef******** *************** **@posting.goog le.com... I have created a function that returns a string containing raw HTML to be used on a web form (see below):
private string GetReportHTML() { string strHTML = "";
// I have some code here that queries a database and // formats the return DataSet as HTML and inserts // this HTML into strHTML for return to the calling // function
return strHTML; }
This HTML content is a report. As such, there is potential for this report, and thus the returned string size, to be very large.
My question is this, would there be any performance benefit by changing this function from returning a string to accepting a "ref string strHTML", considering this string could be very large? (see below)
private void GetReportHTML(r ef strHTML) { }
Thanks in advance.
No. You are already passing back a reference to a string anyway.
-Rob Teixeira [MVP]
"Bob Maggio" <bc*****@yahoo. com> wrote in message
news:ef******** *************** **@posting.goog le.com... I have created a function that returns a string containing raw HTML to be used on a web form (see below):
private string GetReportHTML() { string strHTML = "";
// I have some code here that queries a database and // formats the return DataSet as HTML and inserts // this HTML into strHTML for return to the calling // function
return strHTML; }
This HTML content is a report. As such, there is potential for this report, and thus the returned string size, to be very large.
My question is this, would there be any performance benefit by changing this function from returning a string to accepting a "ref string strHTML", considering this string could be very large? (see below)
private void GetReportHTML(r ef strHTML) { }
Thanks in advance.
You probably should to do it a different way altogether. If the report is
large then the string will need to be created in memory. If you have a lot
of people hitting your site you will use much memory.
"Bob Maggio" <bc*****@yahoo. com> wrote in message
news:ef******** *************** **@posting.goog le.com... I have created a function that returns a string containing raw HTML to be used on a web form (see below):
private string GetReportHTML() { string strHTML = "";
// I have some code here that queries a database and // formats the return DataSet as HTML and inserts // this HTML into strHTML for return to the calling // function
return strHTML; }
This HTML content is a report. As such, there is potential for this report, and thus the returned string size, to be very large.
My question is this, would there be any performance benefit by changing this function from returning a string to accepting a "ref string strHTML", considering this string could be very large? (see below)
private void GetReportHTML(r ef strHTML) { }
Thanks in advance. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dmitry |
last post by:
Hi,
I have defined interface for COM components which inludes an argument being
filled with additional error info, if such occurs. If inside I raise COM
Error, I populate that parameter.
In COM environment this architecture works beautifully -- caller application
gets negative HRESULT and error description from IErrorInfo object, and
additional "log" information from that "ref" parameter:
In .Net it just never returns that paramter...
|
by: Dr Duck |
last post by:
GDay all,
Something seems odd to me....
I wrote a simple C# function
public void bind(ref object a, ref object b, bool atob)
{
if(atob)
b = a;
else
|
by: Tee |
last post by:
Hi guys,
I am confused about the usage of "ref".
Please see this code:
private void button3_Click(object sender, System.EventArgs e)
{
|
by: Kris Takacs |
last post by:
Hello,
I recently upgraded a project from Visual Studio 6 to .NET and get the
following error message when I call help:
"The window name "REF" was not defined in your project file."
If I click OK, the help comes up...
Any ideas?
|
by: Cmtk Software |
last post by:
The following code:
public __gc class MyClass
{
public:
void MyFunc (int __gc* number);
};
Generates the following metadata for C# when compiled in VC 2005 with the
/clr:oldsyntax switch in a DLL project:
| |
by: Everton Berz |
last post by:
Hi,
In the follow program I would like to have the parameter "c" in method
"doSomething" as a value parameter, but it's running as a reference
parameter. Why? How can I get parameter "c" as a value (or clone,
copy)?
Current result:
value1
value2
|
by: not_a_commie |
last post by:
A method parameter declared as "const ref" would allow for passing
large structs quickly and enforce that the struct does not get
reassigned. I know there was concern before about the inability of
such a device to enforce that the members don't get set. I don't care
about that. Let them assign the members (all of which I've declared
readonly.) I've started making most of my structs immutable. They're
just so nice to use that way. I just...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |