Click here to Skip to main content
15,896,207 members
Home / Discussions / C#
   

C#

 
GeneralRe: Is it impossible to achive really smooth scrolling horizontal text? Pin
stianstr29-Oct-08 1:32
stianstr29-Oct-08 1:32 
GeneralRe: Is it impossible to achive really smooth scrolling horizontal text? Pin
Mark Churchill29-Oct-08 2:39
Mark Churchill29-Oct-08 2:39 
Questionout Pin
arkiboys28-Oct-08 3:05
arkiboys28-Oct-08 3:05 
AnswerRe: out Pin
Pete O'Hanlon28-Oct-08 3:10
mvePete O'Hanlon28-Oct-08 3:10 
GeneralRe: out Pin
arkiboys28-Oct-08 3:12
arkiboys28-Oct-08 3:12 
GeneralRe: out Pin
Pete O'Hanlon28-Oct-08 3:23
mvePete O'Hanlon28-Oct-08 3:23 
GeneralRe: out Pin
arkiboys28-Oct-08 3:30
arkiboys28-Oct-08 3:30 
GeneralRe: out Pin
Guffa28-Oct-08 4:12
Guffa28-Oct-08 4:12 
That depends on what you want to accomplish. You should use ref for a parameter that is both input and output, and use out for a parameter that is only output.

Preferably you should avoid the ref or out keywords entirely, unless they really benefit the code. In your method you should just pass in the string as a regular parameter, and return the result as the return value of the method:

string type = "hello";

type = ApplyCleansingRulesFurther(type, issued);

private string ApplyCleansingRulesFurther(string type, string issued) { 
  if (type.ToLower().Trim().Contains("hello there")) {
    if (issued.ToLower().Trim().Contains("yes")) {
       type = type.Replace("hello there", "Hello There!");
    }
  }
  return type;
}


(I cleaned up the code a bit... No data type prefixes on variables in a strongly typed language. Note that it's pointless to trim a string when you are using Contains on the result. Also note that eventhough the if statement handles upper case letters, the Replace call doesn't.)

Despite everything, the person most likely to be fooling you next is yourself.

GeneralRe: out Pin
arkiboys29-Oct-08 0:30
arkiboys29-Oct-08 0:30 
QuestionPersonal Opinion Pin
EliottA28-Oct-08 2:43
EliottA28-Oct-08 2:43 
AnswerRe: Personal Opinion Pin
#realJSOP28-Oct-08 2:48
professional#realJSOP28-Oct-08 2:48 
GeneralRe: Personal Opinion Pin
EliottA28-Oct-08 3:22
EliottA28-Oct-08 3:22 
AnswerRe: Personal Opinion Pin
PIEBALDconsult28-Oct-08 11:20
mvePIEBALDconsult28-Oct-08 11:20 
QuestionCalendar Pin
boiDev28-Oct-08 1:56
boiDev28-Oct-08 1:56 
AnswerRe: Calendar Pin
Michael Bookatz28-Oct-08 2:10
Michael Bookatz28-Oct-08 2:10 
AnswerRe: Calendar Pin
#realJSOP28-Oct-08 2:12
professional#realJSOP28-Oct-08 2:12 
GeneralRe: Calendar Pin
Michael Bookatz28-Oct-08 2:14
Michael Bookatz28-Oct-08 2:14 
GeneralRe: Calendar Pin
#realJSOP28-Oct-08 2:42
professional#realJSOP28-Oct-08 2:42 
GeneralRe: Calendar Pin
Michael Bookatz28-Oct-08 2:45
Michael Bookatz28-Oct-08 2:45 
GeneralRe: Calendar Pin
#realJSOP28-Oct-08 2:49
professional#realJSOP28-Oct-08 2:49 
GeneralRe: Calendar Pin
Michael Bookatz28-Oct-08 3:59
Michael Bookatz28-Oct-08 3:59 
GeneralRe: Calendar Pin
#realJSOP28-Oct-08 4:05
professional#realJSOP28-Oct-08 4:05 
QuestionButton.Visible in Base Form Pin
Russell Jones28-Oct-08 1:24
Russell Jones28-Oct-08 1:24 
AnswerRe: Button.Visible in Base Form Pin
Russell Jones28-Oct-08 2:01
Russell Jones28-Oct-08 2:01 
QuestionUsernameToken and custom database Pin
Giorgi Dalakishvili28-Oct-08 0:57
mentorGiorgi Dalakishvili28-Oct-08 0:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.