c# - using some types in multiple classes -


i have class like:

public class soru {      public void sorukaydet(){...}     private static void soruetiketkaydet(guid soruid, etiket etiket, dbmanager db){...}      public guid? soruid { get; set; }     public guid? soranid { get; set; }     public int? bakilmasayisi { get; set; }     public string htmlgovde { get; set; }     public string markdowngovde { get; set; }     public string baslik { get; set; }     public int? kategoriid { get; set; }     public datetime olusturulmatarihi { get; set; }      public list<etiket> etiketler { get; set; } } 

i need class should contain of variables in class "soru". have 2 scenario this.

the first scenario:

public class sorusayfa {      public static list<sorusayfa> sorusayfagetir(){...}         public guid? soruid { get; set; }     public guid? soranid { get; set; }     public int? bakilmasayisi { get; set; }             public string baslik { get; set; }     public int? kategoriid { get; set; }     public int durumid { get; set; }     public double sorupuani { get; set; }     public int cevapsayisi { get; set; }     public int bakilmasayisi { get; set; }     public string kullaniciadi { get; set; }     public double? kisialanpuani { get; set; } } 

the second scenario:

public class sorusayfa {     public static list<sorusayfa> sorusayfagetir(){...}         // refers class soru instead of variables of     public soru mysoru { get; set; }             public int durumid { get; set; }     public double sorupuani { get; set; }     public int cevapsayisi { get; set; }     public int bakilmasayisi { get; set; }     public string kullaniciadi { get; set; }     public double? kisialanpuani { get; set; } } 

in first scenario, there not variable not used, in second scenario variables of mysoru not used(htmlgovde, markdowngovde, olusturulmatarihi, etiketler). in addition, soru , sorusayfa classes used model different actions in asp .net mvc. contain different methods. scenario better?

try third scenario ;)

public class sorubase {     public guid? soruid { get; set; }     public guid? soranid { get; set; }     public int? bakilmasayisi { get; set; }     public string baslik { get; set; }     public int? kategoriid { get; set; } }  public class soru : sorubase {     public string htmlgovde { get; set; }     public string markdowngovde { get; set; }     public datetime olusturulmatarihi { get; set; }      public list<etiket> etiketler { get; set; } }  public class sorusayfa : sorubase {     public int durumid { get; set; }     public double sorupuani { get; set; }     public int cevapsayisi { get; set; }     public int bakilmasayisi { get; set; }     public string kullaniciadi { get; set; }     public double? kisialanpuani { get; set; } } 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -