Friday 15 April 2011

C# Acces functions within methods -


I have created a method in a class and I want to get streamreader sr1 in one class by another method but I can not seem to gain access to the law!

  Public Zero Show SelectFile () {StreamReader sr1 = New Streamerdir (File. OpenRight (ReturnText)); Return Content RD = SR1 Readout (); } Can anybody explain to me how to reach / replace these methods in other ways?  

sr1 local shoSched file () method; It returns to the workspace when the method returns if you want it to appear in another method, then you have to make it a member of your class:

  StreamReader sr1; Public Zero Show SelectFile () {sr1 = New StreamerDeader (File. Open Read (ReturnText)) Return Content RD = SR1. Readout (); } Public Zero Disposal SR1 () {}   

If it is a matter of settling properly, then wrap it in the statement using :

  using the public Zero Show SelectFile () {Streamer sr1 = new streamminder (File. Open Read (ReturnText)) {ReturnContenctRD = sr1.ReadToEnd (); }}    

No comments:

Post a Comment