Click here to Skip to main content
15,887,881 members
Home / Discussions / C#
   

C#

 
GeneralRe: matching exact word c# Pin
Love Allah19-Sep-17 13:00
Love Allah19-Sep-17 13:00 
AnswerRe: matching exact word c# Pin
OriginalGriff19-Sep-17 20:02
mveOriginalGriff19-Sep-17 20:02 
QuestionHow to handle multiple exceptions(Try..Catch) Pin
Bootzilla3319-Sep-17 4:55
Bootzilla3319-Sep-17 4:55 
SuggestionRe: How to handle multiple exceptions(Try..Catch) Pin
Richard Deeming19-Sep-17 5:22
mveRichard Deeming19-Sep-17 5:22 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Bootzilla3319-Sep-17 5:32
Bootzilla3319-Sep-17 5:32 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Richard Deeming19-Sep-17 5:57
mveRichard Deeming19-Sep-17 5:57 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Bootzilla3319-Sep-17 6:05
Bootzilla3319-Sep-17 6:05 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Bootzilla3319-Sep-17 9:58
Bootzilla3319-Sep-17 9:58 
rspxml.Root.Add(
    new XElement("API", "4.0"),
    new XElement("PackageTrackingInfo",
        new XElement("TrackingNumber", prc.ProNumber)
    ),
    new XElement("PackageDestinationLocation",
        new XElement("City", prc.Consignee),
        new XElement("StateProvince", prc.Consignee),
        new XElement("PostalCode", prc.Consignee),
        new XElement("CountryCode", prc.Consignee)
    ),
    new XElement("PackageDeliveryDate",
        new XElement("ScheduledDeliveryDate", prc.Consignee),
        new XElement("ReScheduledDeliveryDate", prc.Consignee)
    ),
    new XElement("TrackingEventHistory",
        prc.History.Select(item => new XElement("TrackingEventDetail",
            // TODO: Use the correct properties from the item, which weren't shown in your code:
            new XElement("EventStatus", item.EventStatus),
            new XElement("EventReason", item.EventReason),
            new XElement("EventDateTime", item.EventDateTime),
            new XElement("EventLocation", item.EventLocation)
        )
    )
);


@RichardDeeming, Question about this code. On the
new XElement("TrackingEventHistory",
        prc.History.Select(item => new XElement("TrackingEventDetail",

line what should that be because you have .Select but that gives me an error 'Shipment.HistoryCollection' does not contain a definition for 'Select' and no extension method 'Select' accepting a first argument of type 'Shipment.HistoryCollection' could be found (are you missing a using directive or an assembly reference?)

Is that code I should use and need to add something to eliminate the error. What I was thinking it should be is:
C#
new XElement("TrackingEventHistory",
         new XElement("TrackingEventDetail",
            // TODO: Use the correct properties from the item, which weren't shown in your code:
            new XElement("EventStatus", prc.History),
            new XElement("EventReason", prc.History),
            new XElement("EventDateTime", prc.History),
            new XElement("EventLocation", prc.History)

GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
eddieangel19-Sep-17 12:18
eddieangel19-Sep-17 12:18 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Bootzilla3320-Sep-17 2:56
Bootzilla3320-Sep-17 2:56 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Richard Deeming20-Sep-17 10:01
mveRichard Deeming20-Sep-17 10:01 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Bootzilla3321-Sep-17 3:58
Bootzilla3321-Sep-17 3:58 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Richard Deeming21-Sep-17 4:32
mveRichard Deeming21-Sep-17 4:32 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Bootzilla3321-Sep-17 4:52
Bootzilla3321-Sep-17 4:52 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Richard Deeming21-Sep-17 5:18
mveRichard Deeming21-Sep-17 5:18 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Bootzilla3321-Sep-17 5:41
Bootzilla3321-Sep-17 5:41 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Richard Deeming21-Sep-17 6:07
mveRichard Deeming21-Sep-17 6:07 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Bootzilla3321-Sep-17 6:15
Bootzilla3321-Sep-17 6:15 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Richard Deeming21-Sep-17 6:19
mveRichard Deeming21-Sep-17 6:19 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Bootzilla3321-Sep-17 6:40
Bootzilla3321-Sep-17 6:40 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Bootzilla3321-Sep-17 18:19
Bootzilla3321-Sep-17 18:19 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Bootzilla3322-Sep-17 2:54
Bootzilla3322-Sep-17 2:54 
AnswerRe: How to handle multiple exceptions(Try..Catch) Pin
eddieangel19-Sep-17 6:07
eddieangel19-Sep-17 6:07 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
Bootzilla3319-Sep-17 6:14
Bootzilla3319-Sep-17 6:14 
GeneralRe: How to handle multiple exceptions(Try..Catch) Pin
eddieangel19-Sep-17 6:30
eddieangel19-Sep-17 6:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.