0
내 프로젝트의 public enum
에서 값을 제거하려고 시도하고 있습니다. 내가 가진 문제는 내가 값을 제거 언제 내가값을 공용 열거 형에서 제거
의 오류가 XML 문서 나 방지이 코드로 무엇 (1,2909)
에 오류가 얻을 수 있다는 것입니다 요소를 제거하는 것에서?
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.6.1586.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http:Site")]
public enum TDOTT {
/// <remarks/>
AD,
/// <remarks/>
AP,
/// <remarks/>
AT,
/// <remarks/>
AT1,
/// <remarks/>
AD1,
/// <remarks/>
ED,
/// <remarks/>
EP,
/// <remarks/>
SP,
}
추가 코드가 필요하면 알려 주시면 기꺼이 알려 드리겠습니다.
편집
이 그것 (I 수동으로 제거하고)
public enum TDOTT {
/// <remarks/>
AD,
/// <remarks/>
AP,
/// <remarks/>
AT,
/// <remarks/>
AT1,
/// <remarks/>
AD1,
/// <remarks/>
ED,
/// <remarks/>
EP,
}
를 요소가 제거 될 때처럼 보이는 그리고 이것은이 C#을
foreach (TDOTT ts in td.DOT)
{
Console.WriteLine("{0}: {1}", ts.T, ts.D);
}
를 사용하여 호출하는 방법이 무엇인지한다 편집 2
이것은 더 많은 C# 구문이며 오류를 생성하는 줄 위의 주석입니다 EDIT 3
이
static void Main(string[] args)
{
List<string> tempList = new List<string> { "666288603319" };
try
{
foreach (var trackingNumber in tempList)
{
TrackRequest request = CreateTrackRequest(trackingNumber);
TrackService service = new TrackService();
//The below line is hit and error is thrown
TrackReply reply = service.track(request);
}
}
catch (SoapException e)
{
Console.WriteLine(e.Detail.InnerText);
}
}
private static TrackRequest CreateTrackRequest(string trackingNumber)
{
TrackRequest request = new TrackRequest();
request.WebAuthenticationDetail = new WebAuthenticationDetail();
request.WebAuthenticationDetail.UserCredential = new WebAuthenticationCredential();
request.WebAuthenticationDetail.UserCredential.Key = usercredentialKEY;
request.WebAuthenticationDetail.UserCredential.Password = usercredentialPassword;
request.WebAuthenticationDetail.ParentCredential = new WebAuthenticationCredential();
request.WebAuthenticationDetail.ParentCredential.Key = parentcredentialKEY;
request.WebAuthenticationDetail.ParentCredential.Password = parentcredentialPassword;
request.ClientDetail = new ClientDetail();
request.ClientDetail.AccountNumber = AccountNumber;
request.ClientDetail.MeterNumber = MeterNumber;
request.TransactionDetail = new TransactionDetail();
request.TransactionDetail.CustomerTransactionId = "any value"; //This is a reference field for the customer. Any value can be used and will be provided in the response.
request.Version = new VersionId();
request.SelectionDetails = new TrackSelectionDetail[1] { new TrackSelectionDetail() };
request.SelectionDetails[0].PackageIdentifier = new TrackPackageIdentifier();
request.SelectionDetails[0].PackageIdentifier.Value = trackingNumber;
request.SelectionDetails[0].PackageIdentifier.Type = TrackIdentifierType.TRACKING_NUMBER_OR_DOORTAG;
request.SelectionDetails[0].ShipDateRangeBeginSpecified = false;
request.SelectionDetails[0].ShipDateRangeEndSpecified = false;
request.ProcessingOptions = new TrackRequestProcessingOptionType[1] { new TrackRequestProcessingOptionType() };
request.ProcessingOptions[0] = TrackRequestProcessingOptionType.INCLUDE_DETAILED_SCANS;
return request;
}
는 TrackRequest
클래스 synatx이 질문은 내가 당신의 public enum TDOTT
실제로 가정을 만들려고하고 다음 FedEx
개발자 API에 대한 진정 경우
public partial class TrackRequest {
private WebAuthenticationDetail webAuthenticationDetailField;
private ClientDetail clientDetailField;
private TransactionDetail transactionDetailField;
private VersionId versionField;
private TrackSelectionDetail[] selectionDetailsField;
private string transactionTimeOutValueInMillisecondsField;
private TrackRequestProcessingOptionType[] processingOptionsField;
/// <remarks/>
public WebAuthenticationDetail WebAuthenticationDetail {
get {
return this.webAuthenticationDetailField;
}
set {
this.webAuthenticationDetailField = value;
}
}
/// <remarks/>
public ClientDetail ClientDetail {
get {
return this.clientDetailField;
}
set {
this.clientDetailField = value;
}
}
/// <remarks/>
public TransactionDetail TransactionDetail {
get {
return this.transactionDetailField;
}
set {
this.transactionDetailField = value;
}
}
/// <remarks/>
public VersionId Version {
get {
return this.versionField;
}
set {
this.versionField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("SelectionDetails")]
public TrackSelectionDetail[] SelectionDetails {
get {
return this.selectionDetailsField;
}
set {
this.selectionDetailsField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(DataType="nonNegativeInteger")]
public string TransactionTimeOutValueInMilliseconds {
get {
return this.transactionTimeOutValueInMillisecondsField;
}
set {
this.transactionTimeOutValueInMillisecondsField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("ProcessingOptions")]
public TrackRequestProcessingOptionType[] ProcessingOptions {
get {
return this.processingOptionsField;
}
set {
this.processingOptionsField = value;
}
}
}
제거 작업을 수행하는 코드의 예를 포함하십시오. – Soviut
@Soviut - 콘솔에서 해당 데이터를보고 싶지 않지만 제거 할 때 XML 오류가 발생하므로 수동으로 요소를 제거합니다. 편집을 참조하십시오. –
왜 downvote? 내게 어떤 이슈가 있었는지 알려 주시면 감사하겠습니다. 뭐야? –