Note that there are some explanatory texts on larger screens.

plurals
  1. POWhen NOT TO USE 'this' keyword?
    primarykey
    data
    text
    <p>Sorry for asking it again, there are already some questions about this keyword. But all of them tell the purpose of 'this'.</p> <p><a href="https://stackoverflow.com/questions/23250/when-do-you-use-the-this-keyword">When do you use this keyword</a><br> <a href="https://stackoverflow.com/questions/843288/c-when-to-use-this-keyword">C# when to use this keyword</a><br> <a href="https://stackoverflow.com/questions/846766/use-of-this-keyword-in-formal-parameters-for-static-methods-in-c">Use of “this” keyword in formal parameters for static methods in C#</a><br> <a href="https://stackoverflow.com/questions/2307115/proper-usage-of-this-keyword-in-c">Proper usage of “this.” keyword in C#?</a></p> <p>My question is <b>when not to use 'this' keyword </b>.<br> OR<br> Is it all right to use this keyword always in situation like the code</p> <pre><code>class RssReader { private XmlTextReader _rssReader; private XmlDocument _rssDoc; private XmlNodeList _xn; protected XmlNodeList Item { get { return _xn; } } public int Count { get { return _count; } } public bool FetchFeed(String url) { this._rssReader = new XmlTextReader(url); this._rssDoc = new XmlDocument(); _rssDoc.Load(_rssReader); _xn = _rssDoc.SelectNodes("/rss/channel/item"); _count = _xn.Count; return true; } } </code></pre> <p>here i have not used 'this' with "_xn" and "_count" also not with "_rssDoc.Load(_rssReader);" is it fine? Should i use "this" with all occurrences of class variables within the class?</p> <p><b>Edit:</b> Is it <em>useless</em> to use 'this' in a class for its own variables?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload