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

C#

 
GeneralRe: Passing Memory Stream between C# Windows Pin
Pete O'Hanlon17-Jul-16 21:12
mvePete O'Hanlon17-Jul-16 21:12 
GeneralRe: Passing Memory Stream between C# Windows Pin
sunsher18-Jul-16 13:01
sunsher18-Jul-16 13:01 
GeneralRe: Passing Memory Stream between C# Windows Pin
sunsher18-Jul-16 13:55
sunsher18-Jul-16 13:55 
GeneralRe: Passing Memory Stream between C# Windows Pin
sunsher18-Jul-16 15:17
sunsher18-Jul-16 15:17 
QuestionLifo and Fifo Pin
Member 1116162514-Jul-16 17:53
Member 1116162514-Jul-16 17:53 
AnswerRe: Lifo and Fifo Pin
Mycroft Holmes14-Jul-16 20:13
professionalMycroft Holmes14-Jul-16 20:13 
AnswerRe: Lifo and Fifo Pin
Richard MacCutchan14-Jul-16 21:42
mveRichard MacCutchan14-Jul-16 21:42 
QuestionReflection problem Pin
Super Lloyd14-Jul-16 4:08
Super Lloyd14-Jul-16 4:08 
I have a class library which analyse whole object graphs with reflection (my Serializer[^])

Unfortunately I stumbled upon a bug with this simple test class
C#
class Generic01<T>
{
    public List<T> Elements;
}

If one get this field type
var fieldType = typeof(Generic01<>).GetTypeInfo().DeclaredFields[0].FieldType;
(NOTE NO generic parameter T, I am trying to look at the generic type definition, not a concrete class)

REMARK in the code I really do the following
var fieldType = typeof(Generic01<int>).GetGenericTypeDefinition().DeclaredFields[0].FieldType;

Then this field has the following problems:
  • fieldType.FullName = null
  • fieldType.IsGeneric = true, but fieldType.IsGenericTypeDefinition = false
This is a problem since I try to store the type information for a concrete subclass of say Generic01<int> by splitting into int, Generic<>, members[0] = { "Element": typeof(List<>) }

However I can't get correct type information for the field (i.e. typeof(List<>))

Any suggestion on how to get this info?

EDIT "found it"
fieldType.Namespace + '.' + fieldType.Name = "System.Collections.Generic.List`1"
I can work with that.. Smile | :)

EDIT 2 even better! If I call GetGenericTypeDefinition() on these strange type data, I get the one I want! i.e. typeof(List<>) OMG | :OMG: Big Grin | :-D
A new .NET Serializer
All in one Menu-Ribbon Bar
Taking over the world since 1371!


modified 14-Jul-16 10:42am.

AnswerRe: Reflection problem Pin
Kenneth Haugland14-Jul-16 4:27
mvaKenneth Haugland14-Jul-16 4:27 
GeneralRe: Reflection problem Pin
Super Lloyd14-Jul-16 4:52
Super Lloyd14-Jul-16 4:52 
GeneralRe: Reflection problem Pin
Kenneth Haugland14-Jul-16 5:24
mvaKenneth Haugland14-Jul-16 5:24 
GeneralRe: Reflection problem Pin
Super Lloyd14-Jul-16 5:27
Super Lloyd14-Jul-16 5:27 
SuggestionRe: Reflection problem Pin
Richard Deeming14-Jul-16 4:41
mveRichard Deeming14-Jul-16 4:41 
GeneralRe: Reflection problem Pin
Super Lloyd14-Jul-16 4:52
Super Lloyd14-Jul-16 4:52 
GeneralRe: Reflection problem Pin
Super Lloyd14-Jul-16 4:54
Super Lloyd14-Jul-16 4:54 
JokeNo overload for method 'PassStructIn' takes 4 arguments Pin
Member 1224497214-Jul-16 4:03
Member 1224497214-Jul-16 4:03 
GeneralRe: No overload for method 'PassStructIn' takes 4 arguments Pin
Eddy Vluggen14-Jul-16 4:05
professionalEddy Vluggen14-Jul-16 4:05 
GeneralRe: No overload for method 'PassStructIn' takes 4 arguments Pin
OriginalGriff14-Jul-16 4:32
mveOriginalGriff14-Jul-16 4:32 
GeneralRe: No overload for method 'PassStructIn' takes 4 arguments Pin
Member 1224497214-Jul-16 20:30
Member 1224497214-Jul-16 20:30 
GeneralRe: No overload for method 'PassStructIn' takes 4 arguments Pin
OriginalGriff14-Jul-16 20:38
mveOriginalGriff14-Jul-16 20:38 
GeneralRe: No overload for method 'PassStructIn' takes 4 arguments Pin
Member 1224497214-Jul-16 21:48
Member 1224497214-Jul-16 21:48 
GeneralRe: No overload for method 'PassStructIn' takes 4 arguments Pin
OriginalGriff14-Jul-16 21:54
mveOriginalGriff14-Jul-16 21:54 
QuestionIssue with accessing object in background thread when converter value updates Pin
Imagiv13-Jul-16 17:07
Imagiv13-Jul-16 17:07 
AnswerRe: Issue with accessing object in background thread when converter value updates Pin
Super Lloyd13-Jul-16 17:48
Super Lloyd13-Jul-16 17:48 
AnswerRe: Issue with accessing object in background thread when converter value updates Pin
Slacker00713-Jul-16 22:45
professionalSlacker00713-Jul-16 22:45 

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.