Click here to Skip to main content
15,895,746 members
Home / Discussions / C#
   

C#

 
GeneralRe: Help can't find how retrieve element in a list!! Pin
papy-boom13-May-08 22:35
papy-boom13-May-08 22:35 
QuestionEnsure a parameter is not null Pin
-Dy13-May-08 5:20
-Dy13-May-08 5:20 
GeneralRe: Ensure a parameter is not null Pin
CPallini13-May-08 5:43
mveCPallini13-May-08 5:43 
AnswerRe: Ensure a parameter is not null Pin
User 665813-May-08 7:25
User 665813-May-08 7:25 
AnswerRe: Ensure a parameter is not null Pin
Dave Sexton13-May-08 10:43
Dave Sexton13-May-08 10:43 
GeneralRe: Ensure a parameter is not null Pin
Vikram A Punathambekar13-May-08 19:06
Vikram A Punathambekar13-May-08 19:06 
AnswerRe: Ensure a parameter is not null Pin
Christian Graus13-May-08 11:45
protectorChristian Graus13-May-08 11:45 
GeneralRe: Ensure a parameter is not null Pin
Malcolm Smart13-May-08 12:35
Malcolm Smart13-May-08 12:35 
Christian Graus wrote:
You have the ref keyword but it only works on value types


Can you explain? String is a predefined reference type, but when passed as a parameter, it is passed by value. To change the string, you have to explicitly mark it as ref in the signature

namespace RefChecker
{
    class Program
    {
        static void changeMyString1(string myString)
        {
            myString += " worked";
        }

        static void changeMyString2(ref string myString)
        {
            myString += " worked"; 
        }

        static void Main(string[] args)
        {
            string string1 = "has it";
            string string2 = "has it";

            changeMyString1(string1);
            changeMyString2(ref string2);

            Console.WriteLine(string1);//outputs has it
            Console.WriteLine(string2);//outputs has it worked

        }
    }
}


Knowledge is hereditary, it will find its way up or down.
Luc Pattyn

and since what every time when i want to add button to this control one add two times
posted in C# forum


GeneralRe: Ensure a parameter is not null Pin
Christian Graus13-May-08 13:23
protectorChristian Graus13-May-08 13:23 
GeneralRe: Ensure a parameter is not null Pin
S. Senthil Kumar13-May-08 17:36
S. Senthil Kumar13-May-08 17:36 
GeneralRe: Ensure a parameter is not null Pin
Vikram A Punathambekar13-May-08 19:08
Vikram A Punathambekar13-May-08 19:08 
GeneralRe: Ensure a parameter is not null Pin
Malcolm Smart13-May-08 21:24
Malcolm Smart13-May-08 21:24 
GeneralRe: Ensure a parameter is not null Pin
S. Senthil Kumar13-May-08 22:38
S. Senthil Kumar13-May-08 22:38 
GeneralRe: Ensure a parameter is not null Pin
Vikram A Punathambekar13-May-08 19:12
Vikram A Punathambekar13-May-08 19:12 
AnswerRe: Ensure a parameter is not null Pin
PIEBALDconsult13-May-08 13:23
mvePIEBALDconsult13-May-08 13:23 
QuestionApp.Config Sharing (sort of) Pin
#realJSOP13-May-08 5:17
mve#realJSOP13-May-08 5:17 
AnswerRe: App.Config Sharing (sort of) Pin
Miszou13-May-08 7:12
Miszou13-May-08 7:12 
GeneralRe: App.Config Sharing (sort of) Pin
#realJSOP13-May-08 8:31
mve#realJSOP13-May-08 8:31 
GeneralRe: App.Config Sharing (sort of) Pin
Miszou13-May-08 9:04
Miszou13-May-08 9:04 
GeneralRe: App.Config Sharing (sort of) Pin
#realJSOP13-May-08 10:57
mve#realJSOP13-May-08 10:57 
GeneralRe: App.Config Sharing (sort of) Pin
Miszou14-May-08 6:45
Miszou14-May-08 6:45 
QuestionException Handling Pin
jchigg200013-May-08 5:13
jchigg200013-May-08 5:13 
AnswerRe: Exception Handling Pin
jchigg200013-May-08 5:43
jchigg200013-May-08 5:43 
QuestionMenuStrip -> Open new child form Pin
benjamin yap13-May-08 4:31
benjamin yap13-May-08 4:31 
AnswerRe: MenuStrip -> Open new child form Pin
Gareth H13-May-08 4:38
Gareth H13-May-08 4:38 

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.