Click here to Skip to main content
15,916,941 members
Home / Discussions / C#
   

C#

 
QuestionCode in c# Pin
Mody_20048-Dec-18 4:07
Mody_20048-Dec-18 4:07 
AnswerRe: Code in c# Pin
OriginalGriff8-Dec-18 4:23
mveOriginalGriff8-Dec-18 4:23 
AnswerRe: Code in c# Pin
Eddy Vluggen8-Dec-18 5:11
professionalEddy Vluggen8-Dec-18 5:11 
AnswerRe: Code in c# Pin
Dave Kreskowiak9-Dec-18 5:13
mveDave Kreskowiak9-Dec-18 5:13 
AnswerRe: Code in c# Pin
Kevin Marois10-Dec-18 8:07
professionalKevin Marois10-Dec-18 8:07 
Questionhow to bind all text filed with dropdownlist data selection in kendo grid,give any example Pin
Member 115679596-Dec-18 1:25
Member 115679596-Dec-18 1:25 
AnswerRe: how to bind all text filed with dropdownlist data selection in kendo grid,give any example Pin
OriginalGriff6-Dec-18 2:35
mveOriginalGriff6-Dec-18 2:35 
GeneralRe: how to bind all text filed with dropdownlist data selection in kendo grid,give any example Pin
Richard Andrew x648-Dec-18 5:32
professionalRichard Andrew x648-Dec-18 5:32 
QuestionThere is already an open DataReader associated with this Command which must be closed first. Pin
govind_nanna5-Dec-18 19:45
govind_nanna5-Dec-18 19:45 
AnswerRe: There is already an open DataReader associated with this Command which must be closed first. Pin
Pete O'Hanlon5-Dec-18 20:54
mvePete O'Hanlon5-Dec-18 20:54 
AnswerRe: There is already an open DataReader associated with this Command which must be closed first. Pin
OriginalGriff5-Dec-18 21:30
mveOriginalGriff5-Dec-18 21:30 
JokeRe: There is already an open DataReader associated with this Command which must be closed first. Pin
Richard Deeming6-Dec-18 8:01
mveRichard Deeming6-Dec-18 8:01 
GeneralRe: There is already an open DataReader associated with this Command which must be closed first. Pin
OriginalGriff6-Dec-18 20:44
mveOriginalGriff6-Dec-18 20:44 
GeneralRe: There is already an open DataReader associated with this Command which must be closed first. Pin
Richard MacCutchan6-Dec-18 23:21
mveRichard MacCutchan6-Dec-18 23:21 
GeneralRe: There is already an open DataReader associated with this Command which must be closed first. Pin
OriginalGriff6-Dec-18 23:31
mveOriginalGriff6-Dec-18 23:31 
GeneralRe: There is already an open DataReader associated with this Command which must be closed first. Pin
Pete O'Hanlon7-Dec-18 1:17
mvePete O'Hanlon7-Dec-18 1:17 
GeneralRe: There is already an open DataReader associated with this Command which must be closed first. Pin
OriginalGriff7-Dec-18 1:40
mveOriginalGriff7-Dec-18 1:40 
QuestionDynamic alignment of winform controls Pin
george49864-Dec-18 17:52
professionalgeorge49864-Dec-18 17:52 
AnswerRe: Dynamic alignment of winform controls Pin
Dave Kreskowiak4-Dec-18 17:56
mveDave Kreskowiak4-Dec-18 17:56 
GeneralRe: Dynamic alignment of winform controls Pin
george49864-Dec-18 18:38
professionalgeorge49864-Dec-18 18:38 
AnswerRe: Dynamic alignment of winform controls Pin
Eddy Vluggen5-Dec-18 2:03
professionalEddy Vluggen5-Dec-18 2:03 
AnswerRe: Dynamic alignment of winform controls Pin
BillWoodruff5-Dec-18 14:44
professionalBillWoodruff5-Dec-18 14:44 
QuestionReflection - from Type to Class (not instance of class) Pin
devvvy4-Dec-18 13:51
devvvy4-Dec-18 13:51 
AnswerRe: Reflection - from Type to Class (not instance of class) Pin
OriginalGriff4-Dec-18 21:31
mveOriginalGriff4-Dec-18 21:31 
Why?
Why not just return a List<Car> - the base type for the derived classes? All you have to do is tell Newtonsoft what you are doing:
C#
public abstract class Car
    {
    public int InCar { get; set; }
    }
public class Porche : Car
    {
    public string InPorche { get; set; }
    }
public class Toyota: Car
    {
    public int InToyota { get; set; }
    }

C#
Porche p = new Porche();
p.InCar = 111;
p.InPorche = "ppp";
Toyota t = new Toyota();
t.InCar = 222;
t.InToyota = 666;
List<Car> cars = new List<Car>() { p, t };
JsonSerializerSettings settings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All };
string json = JsonConvert.SerializeObject(cars, settings);
List<Car> result =JsonConvert.DeserializeObject<List<Car>>(json, settings);
And it will sort it all out.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!

AnswerRe: Reflection - from Type to Class (not instance of class) Pin
F-ES Sitecore5-Dec-18 1:02
professionalF-ES Sitecore5-Dec-18 1:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.