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

  • Home
  • SEARCH
  • 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 8990249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:27:39+00:00 2026-06-15T22:27:39+00:00

As an example, suppose I had a large amount of data about a set

  • 0

As an example, suppose I had a large amount of data about a set of Restaurants for a large set of Dates in a database that I need to analyze / output to the user.

So, in my code, I have a custom class that holds the data for each restaurant for each date – For example:

Public Class DateData
    Public Property Var1 As Double = 0
    Public Property Var2 As Double = 0
    Public Property Var3 As Double = 0
    Public Property Var4 As Double = 0

    Public Sub Sub1()
      ....
    End Sub

   ... etc ....
End Class

And since I am getting this data for each date (and since date-order does matter for my calculations), I have the following class set up too (where most of the work / calculation is done):

Public Class RestaurantData
    Inherits SortedDictionary(Of Date, DateData)

   Public Property Name As String
   Public Property RestaurantLevelData1 As Double = 0
   Public Property RestaurantLevelData2 As Double = 0

   Public Sub New(ByVal strName As String, ByVal DatesList As List(Of Date))
       _Name = strName
       For Each daDate As Date In DatesList
           Me.Add(daDate)
       Next
   End Sub

   Public Overloads Sub Add(ByVal daDate As Date)
        MyBase.Add(daDate, New DateData)
   End Sub

   Public Sub Sub1()
       For i As Integer = 0 To Me.Keys.Count - 1
           Dim daDate As Date = Me.Keys(i)
           Me(daDate).Sub1()
           .... etc ....
       Next
   End Sub

   ... etc ....
End Class

And, finally, since this is for a large amount of restaurants, I have a class which holds this Dictionary on a restaurant level – For example:

Public Class RestaurantsDict
    Inherits Dictionary(Of String, RestaurantData)

   Public Overloads Sub Add(ByVal strName As String, ByVal Dates As List(Of Date))
       MyBase.Add(strName, New RestaurantData(strName, Dates))
   End Sub
End Class

Ok, so now that I’ve set this up, I have 2 main questions:

  1. Is this a good way to set this up?
    My original code consisted of dozens of Dictionary(Of String, SortedDictionary(Of Date, Double))
    But I am a fairly novice programmer and would love to know if there is a more efficient architecture for what I am trying to achieve.

  2. The way I am currently setting this up is very hard to debug – For example, the Count property of my RestaurantData throws an exception of type System.TypeLoadException.

Overall, this solution is working perfectly well, but I would like to learn from this about how to become a better .Net & OOP programmer.

Thanks!

  • 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-15T22:27:40+00:00Added an answer on June 15, 2026 at 10:27 pm

    This is essentially just opinion, so it’s not a great fit for this site, but it is a great question.

    The simple answer is that there is nothing wrong with it at all, but that it’s certainly not necessary, so it depends on the situation whether or not it’s worthwhile. For instance, normally there’s no reason to use anything other than an Integer, String, or Guid to represent an ID of some sort. However, if there is concern that someone could easily get confused between, say, a UserId and a EmployeeId, then it may be worth it to make your own specific type for each so that you can’t accidentally pass the wrong one. But normally speaking you wouldn’t want to add the extra layer of confusion.

    With generic collections, I’d normally say that there is no reason to do so, but when you have lists of lists, I can see the desire to try to simplify it a little, if nothing else just to save on the lengthy syntax for the type names.

    When you consider that, if generics did not exist (such as in .NET 1.0), you would have to define your own custom types like this, it’s obvious that generics are just a matter of convenience. So, if it’s more convenient to just use a Dictionary(Of String, SortedDictionary(Of Date, Double)), then just do that, but if it’s more convenient to derive your own class from that, then do that.

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

Sidebar

Related Questions

Suppose I had a string for example: >>> stri = "日本" >>> res =
For example, suppose I had written my own class which allowed me to record
Example: Suppose in the following example I want to match strings that do not
Suppose I have a example.php file like that: <p> <?php echo _('Hello world') ?>
Suppose I wanted to create a WCF WebHTTP service (ServiceREST) that had a reference
I am using python, and suppose i had some code as below example.py import
Suppose i had the following string str = 'http://www.example.com/servlet/av/jd?ai=782&ji=2553120&sn=I' I want to get only
Suppose i had a url as below url = 'https://www.advertise-example.com/ads/2022/presents' Now i am trying
Supposing, for example, that I had a 10x10 cloth mesh, with each square being
For example suppose I have the following two functions function a(param1) { console.log(param1); }

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.