更好假設我有以下組中的靜態函數這是在這種情況下,返回或ref
在這裏,我通過引用發送的變量:
public static void ProcessEmailMessage(ref string HTML)
{
ModifyLinks(ref HTML);
AddFakeImage(ref HTML);
}
public static void ModifyLinks(ref string HTML)
{
//modify HTML links
}
public static void AddFakeImage(ref string HTML)
{
//adds an image to the HTML
}
和在這裏,我通過值
發送的可變public static string ProcessEmailMessage(string HTML)
{
HTML = ModifyLinks(HTML);
HTML = AddFakeImage(HTML);
return HTML;
}
public static string ModifyLinks(string HTML)
{
//modify HTML links
return HTML;
}
public static string AddFakeImage(string HTML)
{
//adds an image to the HTML
return HTML;
}
哪一個更有意義,2是否有任何性能差異?
** b)** ......... – I4V 2013-04-23 17:42:23