class-structure

How to build a class structure, when members are also structured hierarchically?

久未见 提交于 2019-12-20 17:40:40
问题 I'm building a PHP web application, that should provide to the user a possiblity to order an "installation"/setup of a (ConnectDirect or File Transfer Gateway) connection between him and another person/organization. (The technical specifica of the connection implementation are not important -- in the application it's only about the connections as product, that can be ordered and managed.) The classes hierarchy for its model layer should represent following real-world infrastructure: There are

Best Way to Organize PHP Class Hierarchy

試著忘記壹切 提交于 2019-12-20 02:32:40
问题 I've got a somewhat primitive framework I've been using for most of my projects, but a general design issue came to mind that I haven't been able to work out yet. For a given application, should I separate the application-specific class structure from the framework's structure, or is building on top of the framework not such a bad thing? For example, say I had a framework with a base Controller class and extended it for a given part of my application. Which arrangement makes the most sense,

How to properly structurate the visibility of this Class?

时光怂恿深爱的人放手 提交于 2019-12-11 17:54:31
问题 I'm trying to improve an old Class that I've wrote to manage an INI file, the Class contains 3 sub-Classes ( File , Key , Section ) to separate and organize the procedures (procs for the ini in general, procs for manage the keys/values, and procs for manage the section names). Well, the problem I have is that in the old class all the members were shared (props/vars/objects/methods) and obviouslly that could result in a disimbiguation, then I would like to try to perfectionate the visibility

.NET Nested Classes

非 Y 不嫁゛ 提交于 2019-12-02 13:53:40
问题 The current class library I am working on will have a base class (Field) with over 50 specific "field" types which will inherit from "Field" and nested for maintain readability. For example... abstract class Field { public int Length { get; set; } public class FieldA : Field { public static void DoSomething() { Console.WriteLine("Did something."); } } } So far everything looks good and I can use the code as shown: class Program { static void Main(string[] args) { Field.FieldA.DoSomething(); }

.NET Nested Classes

自古美人都是妖i 提交于 2019-12-02 05:32:47
The current class library I am working on will have a base class (Field) with over 50 specific "field" types which will inherit from "Field" and nested for maintain readability. For example... abstract class Field { public int Length { get; set; } public class FieldA : Field { public static void DoSomething() { Console.WriteLine("Did something."); } } } So far everything looks good and I can use the code as shown: class Program { static void Main(string[] args) { Field.FieldA.DoSomething(); } } However, why does this work as well? What is going on here that allows the compiler / IDE

Best Way to Organize PHP Class Hierarchy

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 21:09:29
I've got a somewhat primitive framework I've been using for most of my projects, but a general design issue came to mind that I haven't been able to work out yet. For a given application, should I separate the application-specific class structure from the framework's structure, or is building on top of the framework not such a bad thing? For example, say I had a framework with a base Controller class and extended it for a given part of my application. Which arrangement makes the most sense, and why? Class Structure A: Intuitive, easy to find source files when debugging. File naming/directory

C#: List All Classes in Assembly

三世轮回 提交于 2019-11-26 13:03:35
I'd like to output (programmatically - C#) a list of all classes in my assembly. Any hints or sample code how to do this? Reflection? Use Assembly.GetTypes . For example: Assembly mscorlib = typeof(string).Assembly; foreach (Type type in mscorlib.GetTypes()) { Console.WriteLine(type.FullName); } I'd just like to add to Jon's example. To get a reference to your own assembly, you can use: Assembly myAssembly = Assembly.GetExecutingAssembly(); System.Reflection namespace. If you want to examine an assembly that you have no reference to, you can use either of these: Assembly assembly = Assembly

C#: List All Classes in Assembly

非 Y 不嫁゛ 提交于 2019-11-26 02:54:41
问题 I\'d like to output (programmatically - C#) a list of all classes in my assembly. Any hints or sample code how to do this? Reflection? 回答1: Use Assembly.GetTypes. For example: Assembly mscorlib = typeof(string).Assembly; foreach (Type type in mscorlib.GetTypes()) { Console.WriteLine(type.FullName); } 回答2: I'd just like to add to Jon's example. To get a reference to your own assembly, you can use: Assembly myAssembly = Assembly.GetExecutingAssembly(); System.Reflection namespace. If you want