Hi
I have a code here:

public static StringBuilder sb;
        private static bool isRecording = false;
        private static bool isWritingDocument = false;

I would like to know what is the role of IsRecording here? I know it's a variable. I would like to understand the meaning here

Thanks

Recommended Answers

All 4 Replies

Dear,

How can you want to understand the meaming of this code? You say that it's variable. In fact it is a static data member (field). I think your code uses some sort of status control mechanism and the field name you mentioned is for that purpose.

If you asked this question to Anders Hejlsberg (The architect of C#) he wouldn't be able answer you. Return back to the example explanation to find out what isRecording is? or at least copy the full code here to be able to guess.
I guess it's to indicate file status (saved\unsaved)

Dear,

How can you want to understand the meaming of this code? You say that it's variable. In fact it is a static data member (field). I think your code uses some sort of status control mechanism and the field name you mentioned is for that purpose.

hi adatapost, thanks for the input. i'm still confuse with the names like fields, methods, properties and arguments,
and also like with public void static or private void static...
but thanks for your input

If you asked this question to Anders Hejlsberg (The architect of C#) he wouldn't be able answer you. Return back to the example explanation to find out what isRecording is? or at least copy the full code here to be able to guess. I guess it's to indicate file status (saved\unsaved)

Hi Ramy,
thanks. I tried to do a research about isRecording in C# but I didn't find one. Maybe there is, but I didn't understand because I'm a newbie and didn't have any programming experience. It's all new to me...
Anyway, I copied the first part of the code. This is quite complicated:

public static class WordClass
{
    public static StringBuilder sb;
    private static bool isRecording = false;
    private static bool isWritingDocument = false;

    public static void WordRecordStart(bool isWritingToDoc)
    {
        sb = new StringBuilder();
        isRecording = true;
        isWritingDocument = isWritingToDoc;
    }

    public static void appendData(string data)
    {
        if (isRecording) sb.Append(data + Environment.NewLine);
    }

    public static void WordRecordStop()
    {
        if (isRecording)
        {
            //  string 

            string txtName = "Bfa " + DateTime.Now.ToShortDateString() + Guid.NewGuid() + ".txt";
            string filename = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), txtName);

            if (File.Exists(filename))
            {
                File.Delete(filename);
            }

            FileMode fm = FileMode.Append;
            FileStream fs = new FileStream(filename, fm);

            Byte[] byt = Encoding.ASCII.GetBytes(sb.ToString());
            fs.Write(byt, 0, byt.Length);
            fs.Close();
        }
    }

Regards

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.