Documents Error: Can not find DataMember

Can not find DataMember, this maybe an error.

public class QueryPerson : QueryBase<Person>
{
    [DataMember("first_name")]
    public string FirstName { get; set; }
}

Seriously? This is exactly what I’m talking about (and just minutes later too!), have you actually searched for DataMember? It shows up as the first Google result. Reference the System.Runtime.Serialization .NET assembly.

Hi
My DataMemeber can not accept parameters, I has resharp so i get this error easy, I think maybe you implement a new data memeber… and then i ask question here…

namespace System.Runtime.Serialization
{
  [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
  [__DynamicallyInvokable]
  public sealed class DataMemberAttribute : Attribute
  {
    private int order = -1;
    private bool emitDefaultValue = true;
    private string name;
    private bool isNameSetExplicit;
    private bool isRequired;

    [__DynamicallyInvokable]
    public string Name
    {
      [__DynamicallyInvokable, TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] get
      {
        return this.name;
      }
      [__DynamicallyInvokable] set
      {
        this.name = value;
        this.isNameSetExplicit = true;
      }
    }

    internal bool IsNameSetExplicit
    {
      [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] get
      {
        return this.isNameSetExplicit;
      }
    }

    [__DynamicallyInvokable]
    public int Order
    {
      [__DynamicallyInvokable, TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] get
      {
        return this.order;
      }
      [__DynamicallyInvokable] set
      {
        if (value < 0)
          throw DiagnosticUtility.ExceptionUtility.ThrowHelperError((Exception) new InvalidDataContractException(SR.GetString("OrderCannotBeNegative")));
        this.order = value;
      }
    }

    [__DynamicallyInvokable]
    public bool IsRequired
    {
      [__DynamicallyInvokable, TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] get
      {
        return this.isRequired;
      }
      [__DynamicallyInvokable, TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] set
      {
        this.isRequired = value;
      }
    }

    [__DynamicallyInvokable]
    public bool EmitDefaultValue
    {
      [__DynamicallyInvokable, TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] get
      {
        return this.emitDefaultValue;
      }
      [__DynamicallyInvokable, TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] set
      {
        this.emitDefaultValue = value;
      }
    }

    [__DynamicallyInvokable]
    public DataMemberAttribute()
    {
    }
  }
}

[DataMember(Name=“first_name”)]

Hi, I write 7 years C++ and do not know C# very well, forgive me answer too naive questions.

But it’s still a documents error…

So use the Name property:

[DataMember(Name = "first_name")]

Sigh.