Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7669883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:41:46+00:00 2026-05-31T15:41:46+00:00

I was initializing the object in the code below using simple properties but then

  • 0

I was initializing the object in the code below using simple properties but then refactored elsewhere such that DispatchedDocumentDate became DispatchedPhase.DocumentDate. I did this because there is also sold and picked classes using precisely the same properties.

So now in a referencing assembly I have this code which doesn’t compile:

 public List<ItemMovementEntry> FillItemDispatchMovements(IEntityDateRange imqp)
        {
            var f = from detail in this.Context.DispatchDetails
                    join header in this.Context.Dispatches on detail.ClientOrderNumber equals header.ClientOrderNumber
                    where (detail.ProductCode == imqp.ItemKey)
                     && (header.DateOrdered >= imqp.StartDate)
                     && (header.DateOrdered <= imqp.EndDate)
                    orderby header.DateOrdered descending
                    select new ItemMovementEntry(ItemMovementEntryKind.Dispatch)
                    {
                        DispatchedPhase.DocumentDate = ((header.DateOrdered.HasValue) ? header.DateOrdered.Value : new DateTime(1900, 1, 1)),
                        DispatchedPhase.DocumentLKey = header.ClientOrderNumber,
                        MaterialItemLkey = detail.ProductCode,
                        DispatchedPhase.MovementDeltaQty = ((detail.QuantityDelivered.HasValue) ? (-1) * detail.QuantityDelivered.Value : 0),
                        DispatchedPhase.Comment = string.Empty,
                        JournalType = "DISPATCHED",
                    };
            return f.ToList<ItemMovementEntry>();
        }

I get an :

Invalid initializer member declarator

error message.

Hopefully the intent is clear but I’m not sure how to rewrite. I Googled and got something about Let but it was still unclear.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T15:41:47+00:00Added an answer on May 31, 2026 at 3:41 pm

    At this point I will go with adding an extra constructor to the ItemMovementEntry class specifically to deal with this problem.

       public ItemMovementEntry(ItemMovementEntryKind comparerMovementKind,
                        DateTime documentDate,
                        string documentLKey,
                        string materialItemKey,
                        int movementDeltaQty,
                        string comment)
                : this(comparerMovementKind)
            {
                ItemMovementEntryPhase p = null;
                switch (comparerMovementKind)
                {
                    case ItemMovementEntryKind.Sales:
                        p = this.SoldPhase;
                        break;
                    case ItemMovementEntryKind.Picking:
                        p = this.PickedPhase;
                        break;
                    case ItemMovementEntryKind.Dispatch:
                        p = this.DispatchedPhase;
                        this.JournalType = "DISPATCHED";
                        break;
                }
                p.DocumentDate = documentDate;
                p.DocumentLKey = documentLKey;
                this.MaterialItemLkey = materialItemKey;
                p.MovementDeltaQty = movementDeltaQty;
                p.Comment = comment;
            }
    
        public List<ItemMovementEntry> FillItemDispatchMovements(IEntityDateRange imqp)
        {
            var f = from detail in this.Context.DispatchDetails
                    join header in this.Context.Dispatches on detail.ClientOrderNumber equals header.ClientOrderNumber
                    where (detail.ProductCode == imqp.ItemKey)
                     && (header.DateOrdered >= imqp.StartDate)
                     && (header.DateOrdered <= imqp.EndDate)
                    orderby header.DateOrdered descending
                    select new ItemMovementEntry(ItemMovementEntryKind.Dispatch,
                        ((header.DateOrdered.HasValue) ? header.DateOrdered.Value : new DateTime(1900, 1, 1)),
                        header.ClientOrderNumber,
                        detail.ProductCode,
                        ((detail.QuantityDelivered.HasValue) ? (-1) * detail.QuantityDelivered.Value : 0),
                        string.Empty){};
            return f.ToList<ItemMovementEntry>();
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When initializing a new Date object in JavaScript using the below call, I found
I am iterating through the object and initializing all the properties of that object.
What is the problem with initializing a matrix object to NULL and then growing
I am using EF 4.1 Code First and I am having trouble initializing my
the code below is working, but I want to make sure it's correct .
My concern in the code below is that the param to constructor is not
I have this code will work in multithreaded application. I know that immutable object
I want to convert function object to function. I wrote this code, but it
Although I get it that $a = new b() would be initializing an object
I have certain initializing functions that I use to set up audit logging on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.