Why is some of the Microsoft .NET Framework Reference Source invalid C# code?

464 views Asked by At

I noticed that some of the Microsoft .NET Framework reference source doesn't seem to be valid or at least complete C# code.

Here's an example: https://referencesource.microsoft.com/#System.Xaml/System/Windows/Markup/StaticExtension.cs

Relevant code:

[MarkupExtensionReturnType(typeof(object))]
[TypeConverter(typeof(StaticExtensionConverter))]
[TypeForwardedFrom("PresentationFramework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")]
public class StaticExtension : MarkupExtension
{
    [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
    public StaticExtension();
    public StaticExtension(string member);

    [ConstructorArgument("member")]
    public string Member { get; set; }

    [DefaultValue(null)]
    public Type MemberType { get; set; }

    public override object ProvideValue(IServiceProvider serviceProvider);
}

Neither of the constructors nor the ProvideValue() method have bodies. As far as I know this isn't valid C# syntax as it is not an abstract class.

Since this is "reference source" - aren't you supposed to be able to read how it works in order to understand what it actually does? Without the bodies... that doesn't seem possible.

So I feel like I must be missing some other resource with more / complete code, misunderstanding something about C#, or misunderstanding what the reference source is for.


I have read that there are some oddities in the reference source regarding censorship of possible obscenities, but that doesn't seem to explain this. https://stackoverflow.com/a/33873904/3195477

0

There are 0 answers