Is this CLS compliant?

G

Guest

Hello, friends,

I defined a C# class like the follows in .net 2.0:

[Serializable]
public class ContractInfo
{
private string number;
private string transCode;
private int? vcCode;
private DateTime? termFrom;
private DateTime? termTo;
private decimal? revMax;
private DataTable dtAttribute;

public ContractInfo()
{
}

public string Number {set {this.number = value;}get {return
this.number;}}
public string TransCode {set {this.transCode = value;}get {return
this.transCode;}}
public int? VCCode {set {this.vcCode = value;}get {return
this.vcCode;}}
public DateTime? TermFrom {set {this.termFrom = value;}get {return
this.termFrom;}}
public DateTime? TermTo {set {this.termTo = value;}get {return
this.termTo;}}
public decimal? RevMax {set {this.revMax = value;}get {return
this.revMax;}}
public DataTable DTAttribute { set { this.dtAttribute =
value.Copy(); } get { return this.dtAttribute; } }
}

and I called a Window Form function, in which a ContractInfo data type
parameter was passed as the follows:

public void PopulateContractInfo(ContractInfo contractInfo)
{
..........
}

When our build machine compiled, it complained, saying: Argument type
'Contract.ContractInfo' is not CLS-compliant. (CS3001)

I checked our code, I saw that we did have [assembly: CLSCompliant(true)] in
AssemblyInfo.cs.

So, I was confused.

Any ideas, reference papers? How to fix it? Thanks a lot.
 
R

RobinS

I suspect it's the DataTable that's getting you. Try taking it out and see
if it compiles.

Robin S.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top