Click here to Skip to main content
15,886,714 members
Home / Discussions / C#
   

C#

 
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 
AnswerRe: Reflection - from Type to Class (not instance of class) Pin
Richard Deeming5-Dec-18 9:09
mveRichard Deeming5-Dec-18 9:09 
QuestionCode refactoring.. Pin
Simon_Whale4-Dec-18 2:49
Simon_Whale4-Dec-18 2:49 
AnswerRe: Code refactoring.. Pin
dan!sh 4-Dec-18 3:29
professional dan!sh 4-Dec-18 3:29 
AnswerRe: Code refactoring.. Pin
Gerry Schmitz4-Dec-18 8:06
mveGerry Schmitz4-Dec-18 8:06 
AnswerRe: Code refactoring.. Pin
Luc Pattyn4-Dec-18 21:53
sitebuilderLuc Pattyn4-Dec-18 21:53 
QuestionRdlc reporting page break doesnt work- URGENT Pin
Member 132642683-Dec-18 18:40
Member 132642683-Dec-18 18:40 
AnswerRe: Rdlc reporting page break doesnt work- URGENT Pin
Richard MacCutchan3-Dec-18 21:56
mveRichard MacCutchan3-Dec-18 21:56 
AnswerRe: Rdlc reporting page break doesnt work- URGENT Pin
OriginalGriff3-Dec-18 22:16
mveOriginalGriff3-Dec-18 22:16 
QuestionScan Barcode Get Product Image Pin
Kevin Marois2-Dec-18 12:02
professionalKevin Marois2-Dec-18 12:02 
AnswerRe: Scan Barcode Get Product Image Pin
Dave Kreskowiak2-Dec-18 16:27
mveDave Kreskowiak2-Dec-18 16:27 
AnswerRe: Scan Barcode Get Product Image Pin
OriginalGriff2-Dec-18 19:49
mveOriginalGriff2-Dec-18 19:49 
GeneralRe: Scan Barcode Get Product Image Pin
Kevin Marois3-Dec-18 6:43
professionalKevin Marois3-Dec-18 6:43 
QuestionWPF and C# - Passing Data and accessing Controls between Child Windows Pin
James Wyatt2-Dec-18 5:45
James Wyatt2-Dec-18 5:45 
AnswerRe: WPF and C# - Passing Data and accessing Controls between Child Windows Pin
OriginalGriff2-Dec-18 5:58
mveOriginalGriff2-Dec-18 5:58 
GeneralRe: WPF and C# - Passing Data and accessing Controls between Child Windows Pin
James Wyatt2-Dec-18 6:13
James Wyatt2-Dec-18 6:13 
GeneralRe: WPF and C# - Passing Data and accessing Controls between Child Windows Pin
OriginalGriff2-Dec-18 6:27
mveOriginalGriff2-Dec-18 6:27 

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.