Extracting property names from a c# source file
<p>I want to parse a c# file. The only thing I want is to determine if it contains a property with a specific name; just a simple true/false response. Or rather, since I'd checking for more than one property in each run, extracting a list of property names could be helpful</p>

<p>I thought that I could create an elegant solution using the <code>CodeDomProvider</code> functionality (f# example):</p>

<pre><code>use reader = new StreamReader(existingFile)
let codeProvider = new CSharpCodeProvider()
let codeUnit = codeProvider.Parse(reader)
</code></pre>

<p>Unfortunately, the <code>Parse</code> function is not implemented for the <code>CSharpCodeProvider</code>. Is there a way to get a <code>CodeCompileUnit</code> from a source file? Or is there another elegant way? (I had hoped to avoid regular expressions on this)?</p>

<p>Edit:
I'm going to use this for automatic code generation. Basically, I'm going to generate a partial class in file xyz.partial.cs. This will generate a skeleton property. But if I want to change the implementation of a property, I will cut that property and paste it into the hand coded xyz.cs. When recreating the generated class, I want it to skip generating properties that I have moved to the hand-coded file.</p>

<p>Therefore, reflection is out of the question, because reflection will tell me that the property does indeed exists, but not if it is defined in the one or the other file.</p>
