I am struggling to fix the following problem:
I have list of object and object type is int:
int a = 1;
int b = 2;
int c = 3;
List<object> kk = new List<object>( );
kk.Add( ( object )a );
kk.Add( ( object )b );
kk.Add( ( object )c );
and I want to cast the List<object>
to List<objecttype>
and in above example object type is int. I want to cast List<object>
to List<int>
. Is there a way address this problem?
I am looking for generic solution and assume no knowledge of casting type.