Thread View: alt.pl.comp.lang.csharp
4 messages
4 total messages
Started by news.icpnet.pl
Mon, 24 Oct 2011 09:44
problem z generic
Author: news.icpnet.pl
Date: Mon, 24 Oct 2011 09:44
Date: Mon, 24 Oct 2011 09:44
59 lines
2282 bytes
2282 bytes
Napisałem sobie taką klasę i mam problem:
W programie wartości są niby ok. Jednak na podglądzie zawartości klasy,
w debugu dostaję te błędy których nie wiem jak usunąć. Czy ktoś mógłby
wspomóc mnie wiedzą i pomógł rozwiązać problem?
//Min = <error: an exception of type: System::TypeLoadException^ occurred>
//Max = <error: an exception of type: System::TypeLoadException^ occurred>
/////////////////////////////////////////////////////////////////////////////
generic <typename T> public ref class MinMax : public IComparer
{
private:
T min;
T max;
bool start;
virtual int Compare(Object^ x, Object^ y) sealed = IComparer::Compare
{
return((gcnew CaseInsensitiveComparer)->Compare(x, y));
}
public:
MinMax()
{
start = false;
}
property T Add
{
Void set(T value)
{
if(this->start)
{
this->min = (Compare(value, this->min) < 0) ? value : this->min;
this->max = (Compare(value, this->max) > 0) ? value : this->max;
}
else
{
this->min = this->max = value;
this->start = true;
}
}
}
property T Min { T get() { return this->min; } }
property T Max { T get() { return this->max; } }
Void Clear()
{
if(this->start)
{
this->start = false;
this->min = safe_cast<T>(System::Activator::CreateInstance(T::typeid));
this->max = safe_cast<T>(System::Activator::CreateInstance(T::typeid));
}
}
};
//////////////////////////////////////////////////////////////////////////////
Pozdrawiam
S.Z.
Re: problem z generic
Author: Łukasz 'Maly' Ostrowski
Date: Mon, 24 Oct 2011 11:00
Date: Mon, 24 Oct 2011 11:00
24 lines
1697 bytes
1697 bytes
On Mon, 24 Oct 2011 11:44:02 +0200, news.icpnet.pl wrote: > Napisałem sobie taką klasę i mam problem: > > W programie wartości są niby ok. Jednak na podglądzie zawartości klasy, > w debugu dostaję te błędy których nie wiem jak usunąć. Czy ktoś mógłby > wspomóc mnie wiedzą i pomógł rozwiązać problem? > > > //Min = <error: an exception of type: System::TypeLoadException^ occurred> > //Max = <error: an exception of type: System::TypeLoadException^ occurred> To na pierwszy rzut oka wygląda na błąd w ewaluatorze wyrażen. Wiązałbym to z brakiem IntelliSense dla C++/CLI a tym samym ograniczonymi możliwościami debuggera VS do nawigowania po symbolach etc. Ale to tylko mój strzał. Proponuję zgłosić do: http://connect.microsoft.com/VisualStudio i poczekać na oficjalną odpowiedź. -- Pozdrawiam, Łukasz 'Maly' Ostrowski. http://l3v.eu/
Re: problem z generic
Author: news.icpnet.pl
Date: Mon, 24 Oct 2011 11:27
Date: Mon, 24 Oct 2011 11:27
21 lines
1649 bytes
1649 bytes
>> Napisałem sobie taką klasę i mam problem: >> >> W programie wartości są niby ok. Jednak na podglądzie zawartości klasy, >> w debugu dostaję te błędy których nie wiem jak usunąć. Czy ktoś mógłby >> wspomóc mnie wiedzą i pomógł rozwiązać problem? >> >> >> //Min =<error: an exception of type: System::TypeLoadException^ occurred> >> //Max =<error: an exception of type: System::TypeLoadException^ occurred> > > To na pierwszy rzut oka wygląda na błąd w ewaluatorze wyrażen. > Wiązałbym to z brakiem IntelliSense dla C++/CLI a tym samym > ograniczonymi możliwościami debuggera VS do nawigowania po > symbolach etc. > Chyba raczej nie, kompilowane w vc2008 daje ten sam efekt a tu jest intelisense. Pozdrawiam S.Z.
Re: problem z generic
Author: Łukasz 'Maly' Ostrowski
Date: Mon, 24 Oct 2011 12:17
Date: Mon, 24 Oct 2011 12:17
10 lines
1170 bytes
1170 bytes
On Mon, 24 Oct 2011 13:27:26 +0200, news.icpnet.pl wrote: > Chyba raczej nie, kompilowane w vc2008 daje ten sam efekt a tu jest > intelisense. Ahm, ja sprawdzałem w VS2k10. Reasumując, proponuję skorzystać z Connecta. -- Pozdrawiam, Łukasz 'Maly' Ostrowski. http://l3v.eu/
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads