M
mp
my first attempt to use a base class and subType (if that's the correct
terminology)
defined in Investment.cs:
class Investment
class Stock : Investment
class StockListCollection : List<Stock > { }
definted in view
(defined in Iview.cs interface which view implements)
StockListCollection StockWatchChoiceList { get; set; }
in presenter i'm trying to serialize a StockListCollection from the view
the serialize code takes an argument of List<Investment>
so since StockListCollection is a List<Stock >
and Stock is a Investment
I thought that would work...either i can't 'pass through' from base class to
subclass like that
or something else is wrong in my code or definitions
the signature for the serializing code
public static class XMLInvestmentStore
{
public static void StoreInvestmentChoices ( List<Investment>
InvestmentChoices, string fileName )
{...}
i get the following errors:
first i tried this line
XMLInvestmentStore.StoreInvestmentChoices (
this._mView.StockWatchChoiceList, stockWatchFilename );
and got this error
//Argument '1': cannot convert from
'Investments.Model.StockListCollection' to
'System.Collections.Generic.List<Investments.Model.Investment>'
so i thought i needed a specific cast...so i tried this:
XMLInvestmentStore.StoreInvestmentChoices (
(List<Investment>)this._mView.StockWatchChoiceList, stockWatchFilename );
there i *think* i'm casting a StockListCollection to a List<Investment>???
it's base class???
so then i thought maybe i have to cast stock to investment so i tried
XMLInvestmentStore.StoreInvestmentChoices (
(List<(Investment)Stock>)this._mView.StockWatchChoiceList,
stockWatchFilename );
but apparently you can't "cast inside of another cast"
also tried
XMLInvestmentStore.StoreInvestmentChoices (
(List<Stock>)this._mView.StockWatchChoiceList, stockWatchFilename )
but i get this error
Argument '1': cannot convert from
'System.Collections.Generic.List<Investments.Model.Stock>' to
'System.Collections.Generic.List<Investments.Model.Investment>'
but a Stock Is an Investment so i don't know why I can't make that cast?
at least the error msgs keep changing...so it keeps things interesting...![Smile :-) :-)](/styles/default/custom/smilies/smile.gif)
anyone feel like helping shortcut my trial and error?
thanks
mark
terminology)
defined in Investment.cs:
class Investment
class Stock : Investment
class StockListCollection : List<Stock > { }
definted in view
(defined in Iview.cs interface which view implements)
StockListCollection StockWatchChoiceList { get; set; }
in presenter i'm trying to serialize a StockListCollection from the view
the serialize code takes an argument of List<Investment>
so since StockListCollection is a List<Stock >
and Stock is a Investment
I thought that would work...either i can't 'pass through' from base class to
subclass like that
or something else is wrong in my code or definitions
the signature for the serializing code
public static class XMLInvestmentStore
{
public static void StoreInvestmentChoices ( List<Investment>
InvestmentChoices, string fileName )
{...}
i get the following errors:
first i tried this line
XMLInvestmentStore.StoreInvestmentChoices (
this._mView.StockWatchChoiceList, stockWatchFilename );
and got this error
//Argument '1': cannot convert from
'Investments.Model.StockListCollection' to
'System.Collections.Generic.List<Investments.Model.Investment>'
so i thought i needed a specific cast...so i tried this:
XMLInvestmentStore.StoreInvestmentChoices (
(List<Investment>)this._mView.StockWatchChoiceList, stockWatchFilename );
there i *think* i'm casting a StockListCollection to a List<Investment>???
it's base class???
so then i thought maybe i have to cast stock to investment so i tried
XMLInvestmentStore.StoreInvestmentChoices (
(List<(Investment)Stock>)this._mView.StockWatchChoiceList,
stockWatchFilename );
but apparently you can't "cast inside of another cast"
also tried
XMLInvestmentStore.StoreInvestmentChoices (
(List<Stock>)this._mView.StockWatchChoiceList, stockWatchFilename )
but i get this error
Argument '1': cannot convert from
'System.Collections.Generic.List<Investments.Model.Stock>' to
'System.Collections.Generic.List<Investments.Model.Investment>'
but a Stock Is an Investment so i don't know why I can't make that cast?
at least the error msgs keep changing...so it keeps things interesting...
![Smile :-) :-)](/styles/default/custom/smilies/smile.gif)
anyone feel like helping shortcut my trial and error?
thanks
mark