hi friends,
I have a class Student.Where i declare 5 private field:
marksInMaths,marksInEng,marksInPhy,marksInChem and marksInHin.Then i created a seperate property with get{} and set{} for each namely Math,Phy,Chem,Eng and Hin. All the properties have same purpose for their respective subject.So i think if it is Possible perform all the five properties task in a single property then reduce my code.Is Possible??? if yes then please give an example.
Loading
VulpesPosted Apr 1, 2013, 2:56 PM
Jignesh TrivediPosted Apr 2, 2013, 12:04 AM
yes, agree with vulpes, if you want to reduce the code and if your using .net framework 3.0 or above than you can use auto implemented properties.
as per my understanding all subjects are differnt entity and has different value right?
Arun KurmiPosted Apr 1, 2013, 1:19 PM
Jignesh TrivediPosted Mar 31, 2013, 11:53 PM
it is good idea to use different property for different purpose. in your code all five property has different meaning so as per me it is good to separate them other wise code might become very complicated.
hope this will help you.