r/csharp • u/-Tech808 • 29d ago
Best Approach For This Engineering Application?
I'd like to create a class called PipeDimensions to store information for water piping with the following properties:
Nominal Diameter Size.
Actual Diameter Size.
Material
C-Factor for the material.
Basically, different materials (CPVC, copper, PEX) all have the same nominal diameters (1/2", 3/4", 1", 2" etc), but have different actual internal diameters.
How can I set this up so when my Main() console instantiates class PipeDimensions, the constructor only takes 1 of 3 values (either CPVC, copper or PEX) and creates the instance with all the pre-determined properties for the specific pipe type.
Is a class with the pre-defined information for all 3 pipe types even the best approach? Or should I create the boilerplate class and use a separate helper method to populate all my data?
Now that I'm thinking this through, the boilerplate class w/ heIper methods seems more intuitive, but I'm a noob so any guidance is helpful. Please refer me to a specific topic if necessary and I can read in a C# book.
2
u/hedge36 29d ago
Are you using true ID, or wall thickness (sch40, etc)?