1 vote
closed
Optimization

Description

 
Might want to do a little optimaization here.
Instead of this
public static WebProfile Current {
get {
return new WebProfile(System.Web.HttpContext.Current.Profile);
}
}

Do this
private static WebProfile p_current = null;
public static WebProfile Current {
get {
if (p_current == null)
p_current = new WebProfile(System.Web.HttpContext.Current.Profile);
return p_current;
}
}

This way if someone just keeps calling the WebProfile.Current.etc... like so, then they won’t keep creating new objects. They will be utilizing only one object.
WebProfile.Current.Name = "blah";
WebProfile.Current.Phone = "555-1212";

I haven't looked any where else in the code, so there may be some other places that could use some optimization.

Is this "Code Gallery" based off CodePlex? If so, is there ways of getting access, so that I can help.
I would much rather do the update than bother you about it.

John

File Attachments


No files are attached


Closed Apr 17 2008 at 7:01 AM  by robolize
Added this to code base.

Comments

most recent at top (show oldest at top)
robolize wrote Apr 16 2008 at 5:14 PM
John,
Thanks for your feedback and interest. I have added this suggested change into the new release.

I appreciate your willingness to help. Having this project on the Code Gallery does make it difficult for others to contribute. I have had some interest from a few other people so I think I will make the transition to CodePlex soon (preferably for the next release).


Updating...
Page view tracker