Click here to Skip to main content
15,929,584 members
Home / Discussions / C#
   

C#

 
GeneralRe: Work with files Pin
suntromantralalalala18-Jul-07 6:47
suntromantralalalala18-Jul-07 6:47 
GeneralRe: Work with files Pin
BoneSoft18-Jul-07 9:10
BoneSoft18-Jul-07 9:10 
AnswerRe: Work with files Pin
BoneSoft18-Jul-07 9:12
BoneSoft18-Jul-07 9:12 
AnswerRe: Work with files Pin
PhilDanger18-Jul-07 8:11
PhilDanger18-Jul-07 8:11 
QuestionReusing a string value Pin
Raymond_P*18-Jul-07 5:28
Raymond_P*18-Jul-07 5:28 
AnswerRe: Reusing a string value Pin
BoneSoft18-Jul-07 5:39
BoneSoft18-Jul-07 5:39 
GeneralRe: Reusing a string value Pin
Raymond_P*18-Jul-07 5:52
Raymond_P*18-Jul-07 5:52 
GeneralRe: Reusing a string value Pin
Luc Pattyn18-Jul-07 5:57
sitebuilderLuc Pattyn18-Jul-07 5:57 
Hi,

if you want a single variable used by several methods, make it a class member, and dont
define it again and again in every method; like so:

class myClass {
    private string myString;

    public void Method1() {
        myString="value1";
    }

    public void Method2() {
        if (myString=="value1") Console.WriteLine("Method1 has been executed !");
    }
}


The way you did it, every method had its own local variable, but they were independent
of each other. Read up on "scope rules".

Smile | :)



AnswerRe: Reusing a string value Pin
lost in transition 18-Jul-07 5:57
lost in transition 18-Jul-07 5:57 
AnswerRe: Reusing a string value Pin
PIEBALDconsult18-Jul-07 8:28
mvePIEBALDconsult18-Jul-07 8:28 
QuestionIntegrating SQL queries into C# Pin
auloepid18-Jul-07 5:04
auloepid18-Jul-07 5:04 
AnswerRe: Integrating SQL queries into C# Pin
Pete O'Hanlon18-Jul-07 5:13
mvePete O'Hanlon18-Jul-07 5:13 
AnswerRe: Integrating SQL queries into C# Pin
Paul Conrad18-Jul-07 5:53
professionalPaul Conrad18-Jul-07 5:53 
AnswerRe: Integrating SQL queries into C# Pin
lost in transition 18-Jul-07 6:00
lost in transition 18-Jul-07 6:00 
GeneralRe: Integrating SQL queries into C# Pin
auloepid18-Jul-07 6:08
auloepid18-Jul-07 6:08 
GeneralRe: Integrating SQL queries into C# Pin
lost in transition 18-Jul-07 6:16
lost in transition 18-Jul-07 6:16 
GeneralRe: Integrating SQL queries into C# Pin
auloepid18-Jul-07 6:21
auloepid18-Jul-07 6:21 
GeneralRe: Integrating SQL queries into C# Pin
lost in transition 18-Jul-07 6:25
lost in transition 18-Jul-07 6:25 
AnswerRe: Integrating SQL queries into C# Pin
PIEBALDconsult18-Jul-07 8:30
mvePIEBALDconsult18-Jul-07 8:30 
QuestionHanlde Event when C# exe is aborted abruptly Pin
harvid18-Jul-07 4:59
harvid18-Jul-07 4:59 
AnswerRe: Hanlde Event when C# exe is aborted abruptly Pin
originSH18-Jul-07 5:46
originSH18-Jul-07 5:46 
AnswerRe: Hanlde Event when C# exe is aborted abruptly Pin
Dave Kreskowiak18-Jul-07 5:48
mveDave Kreskowiak18-Jul-07 5:48 
AnswerRe: Hanlde Event when C# exe is aborted abruptly Pin
Paul Conrad18-Jul-07 5:56
professionalPaul Conrad18-Jul-07 5:56 
GeneralRe: Hanlde Event when C# exe is aborted abruptly Pin
harvid18-Jul-07 20:49
harvid18-Jul-07 20:49 
QuestionQuick question involving xml deserialization and strings Pin
ruanr18-Jul-07 4:22
ruanr18-Jul-07 4:22 

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.