Help me with MSDN 
Author Message
 Help me with MSDN

Following is from MSDN documentation:

"Implements a TextReader that reads characters from a byte stream in a
particular encoding.
For a list of all members of this type, see StreamReader Members.
System.Object
    System.MarshalByRefObject
        System.IO.TextReader
            System.IO.StreamReader

[C++]
[Serializable]
public __gc class StreamReader : public TextReader
class StreamReader extends TextReader
Thread Safety
Any public static (Shared in Visual Basic) members of this type are safe for
multithreaded operations. Any instance members are not guaranteed to be
thread safe."

I have three questions about this paragraph and hope someone can answer them
for me.

1. Why these four namespaces are related and listed like below in the above
paragraph?
2. What's the meaning of the word "Serializable" here?
3. Why "Any public static (Shared in Visual Basic) members of this type are
safe for multithreaded operations. Any instance members are not guaranteed
to be thread safe."?

TIA



Sat, 16 Apr 2005 15:25:52 GMT  
 Help me with MSDN


Quote:
> Following is from MSDN documentation:

> "Implements a TextReader that reads characters from a byte stream in a
> particular encoding.
> For a list of all members of this type, see StreamReader Members.
> System.Object
>     System.MarshalByRefObject
>         System.IO.TextReader
>             System.IO.StreamReader

ie, StreamReader derives from System.IO.TextReader, which derives from
System.MarshalBRefObject, which derives from System.Object

Quote:
> [C++]
> [Serializable]
> public __gc class StreamReader : public TextReader
> class StreamReader extends TextReader

[Serializable] means that you could write the the object's state in a tree
like manner
to a BinaryStream(ordinary file) or XmlStream or MemoryStream and recover
the object back by reading back from the stream.
[Serializable] is an attribute.

Quote:
> Thread Safety
> Any public static (Shared in Visual Basic) members of this type are safe
for
> multithreaded operations. Any instance members are not guaranteed to be
> thread safe."

Meaning that this class is that sycronized. Here's the detailed meaning of
what this is saying.

Suppose u have a global object
StreamReader Global;

that is used by 2 threads  1 and 2

and suppose let's say that the 2 threads do a simulatenoues
Global.Read()

The result is undefined.

Instead, what microsoft wants u to do is take

StreamReader Global;
StreamReader Globalsync = TextReader.Syncronized( Global);

and now when the 2 threads do a simulatenoues
Global.Read()

only one of them gets to go first. The other thread is given access after
the
first thread is done.

Btw, TextReader.Syncronized is a  static function.

Quote:

> I have three questions about this paragraph and hope someone can answer
them
> for me.

> 1. Why these four namespaces are related and listed like below in the
above
> paragraph?
> 2. What's the meaning of the word "Serializable" here?
> 3. Why "Any public static (Shared in Visual Basic) members of this type
are
> safe for multithreaded operations. Any instance members are not guaranteed
> to be thread safe."?

> TIA



Wed, 20 Apr 2005 08:01:37 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. MSDN help gone after MSDN update

2. pasting text from help files or msdn

3. Ann:Add your help files to MSDN/Visual Studio

4. VC++ Help Asks For MSDN CD's?

5. How to insert a custom help file into MSDN?

6. Google is a better MSDN than MSDN

7. MSDN Help

8. problem with MSDN example, I need help.

9. msdn docs drive me nuts, help find CDaoTableDef connect string format description

10. ADO Macros wrong in MSDN Help file

11. New Msdn Help is not accessed by VC 6.0

12. No help in VC++6.0 and MSDN

 

 
Powered by phpBB® Forum Software