Reputation: 24308
I wonder if there is a standard for naming the "concrete" class and the instance.
For example, I have currently a class called Test and its instance is called is called Test as well. I think this is bad.
Is there some sort of standard to name the concrete class and its instance? The instance needs to be Test but the concrete I have no idea what to do; name it TestConcrete?
What does Microsoft do in this situation?
Basically the concrete class is ONLY for use in the Product class to support Nested classes, it will never be instantiated from outside.
Here is my class. I presume I am doing this correct? I am creating the instance of Test inside the constructor of Product.
I don't want to get into bad habits and I am going to be doing a lot of these, and Test (concrete) and Test (instance) is probably a bad idea!
public class Product {
public int Id { get; set; }
private Test Test { get; set; }
public Product()
{
Test = new Test();
}
}
Upvotes: 4
Views: 2015
Reputation: 9676
These are my Guidelines:
public abstract class Test
{
public void FooBar() // Method, capitalization, PascalCase
{
Person fatherFigure = new Person(); // Class instance, lowercase first letter, camelcase rest.
}
public string Name {get; set; } // Property, capitalization, PascalCase
private string PrivateName {set; set; } // Private property, capitalization, camelcase
public string someField; // Field, lowercase first letter, camelcase
private string _someField; // Private member, prefix with _
}
These are only my own opinions. :)
Upvotes: 1
Reputation: 273179
It's not without precedent, I think you can find
Color Color { get; set; }
in the library, and some more like that.
But best way around it is to think of a more specific name, that is Domain driven. Something like
private Test TestResults { get; set; }
or
private TestData Test { get; set; }
Upvotes: 5