This exception is raised when two or more fields in a user-defined class have the same identifiers

Namespace: Dapfor.Net.Exceptions
Assembly: Dapfor.Net (in Dapfor.Net.dll) Version: 2.10.3.24917 (2.10.3.24917)

Syntax

C#
[SerializableAttribute]
public class FieldDeclarationException : DapforException
Visual Basic
<SerializableAttribute>
Public Class FieldDeclarationException
	Inherits DapforException
Visual C++
[SerializableAttribute]
public ref class FieldDeclarationException : public DapforException
F#
[<SerializableAttribute>]
type FieldDeclarationException =  
    class
        inherit DapforException
    end

Remarks

 Copy imageCopy
//Class with identical field identifiers
public class Product
{
    private string name;
    private string description;

    public string Name
    {
        get { return name; }
        set { name = value; }
    }

    //Modify default field identifier
    [Field("Name")]
    public string Description
    {
        get { return description; }
        set { description = value; }
    }
}

void PopulateGrid(Grid grid)
{
    //Initialize the grid
    grid.Headers.Add(new Header());
    grid.Headers[0].Add(new Column("Name"));
    grid.Headers[0].Add(new Column("Description"));

    //The grid throws FieldDeclarationException because Product has two identical fields
    grid.Rows.Add(new Product());
}

Inheritance Hierarchy

System..::..Object
  System..::..Exception
    Dapfor.Net.Exceptions..::..DapforException
      Dapfor.Net.Exceptions..::..FieldDeclarationException

See Also