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 8079009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:58:45+00:00 2026-06-05T15:58:45+00:00

So, this is actually this question is my current keystone. I’m working on refactoring

  • 0

So, this is actually this question is my current keystone.
I’m working on refactoring of my personal project, trying increase performance, optimize memory usage, make code easy and clear. I have a different application layers (actually, DAL, BLL, ServiceAgents which is WCF services). I’m using Entities/Models/DTOs to pass data between those layers, which is stateless (don’t have any logic at all). Currently they’re objects like this:

public class Person
{
  public ComplexId Id { get; set; }
  public string Name { get; set; }
  // ...
}

I used to use such approach, it’s like a “best practice”, is it? Is this best way to store transferred data? What if I change it for struct like this:

public struct Person
{
    public ComplexIdentifier ComplexId;
    public string Name;
}

public struct ComplexIdentifier
{
    public int LocalId;
    public int GlobalId;
}

Is this would be better way from performance/memory usage perspective? Or maybe there is some kind of traps acting that way?

  • 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-06-05T15:58:47+00:00Added an answer on June 5, 2026 at 3:58 pm

    For standard DTO entities, you will want to stick with the class.

    A struct has a much more limited range of potential use cases than classes. There are also efficiency issues when struct types get too large (don’t forget, they are value types and are copied when passed around), as outlined in the MSDN guidelines about value types. Not to mention plenty of gotchas when you start having struct types exposed through properties, or accidentally box it when referencing interfaces, or make them mutable…

    I’m not saying not to use struct when it is relevant, but I very rarely find myself needing to use struct types in our main desktop application – which is layered and features DTO types.


    The performance issue cannot be answered as simply as struct vs. class. You will need to employ a profiling tool such as dotTrace or ANTS in order to find the hotspots and go from there. Performance issues are not trivial and good tooling is usually the start of the answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is actually a two part question. First,does the HttpContext.Current correspond to the current
Problem This question actually came up at work today. We are planning an experiment
Simple question - what does this actually do? var oq = (ObjectQuery<TEntity>)L2EQuery; return ExecuteFirstorDefault<TEntity>(oq,
This is actually a non-critical question, but I get this warning most of the
This is actually related to another question I had that was already answered. That
There are actually 2 question i want to cover in this topic. 1) Is
The first part of this question is actually a request for confirmation based on
The Question actually says it all. The reason behind this question is I am
i have a very simple question, actually this is not the question, this is
This question is more about guidance than actually solving my problem: I need to

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.