Click here to Skip to main content
15,892,059 members
Home / Discussions / C#
   

C#

 
GeneralRe: Threading problem Pin
Sajjad Izadi22-Apr-09 9:06
Sajjad Izadi22-Apr-09 9:06 
GeneralRe: Threading problem Pin
0x3c022-Apr-09 9:28
0x3c022-Apr-09 9:28 
AnswerRe: Threading problem Pin
Luc Pattyn22-Apr-09 8:56
sitebuilderLuc Pattyn22-Apr-09 8:56 
GeneralRe: Threading problem Pin
Fayu22-Apr-09 9:10
Fayu22-Apr-09 9:10 
GeneralRe: Threading problem Pin
0x3c022-Apr-09 9:29
0x3c022-Apr-09 9:29 
GeneralRe: Threading problem Pin
Luc Pattyn22-Apr-09 9:38
sitebuilderLuc Pattyn22-Apr-09 9:38 
GeneralRe: Threading problem Pin
Fayu22-Apr-09 10:04
Fayu22-Apr-09 10:04 
QuestionHelp with generics [modified] Pin
GuimaSun22-Apr-09 8:17
GuimaSun22-Apr-09 8:17 
Hello,
I'm trying to access an element from the following function, can you help me ?
I've tried a lot of constructions without success.

Edit:
I`m using VS2008\.NET 3.5
The function below should access the "i" value for single types and arrays at the same time, for single types it`s ok, but for arrays I don`t know how to access array elements. I can check i.GetType().IsArray, but don`t know how to access particular elements.

static void function<t>(ref T i)
{
string s;
if ( !i.GetType().IsArray )
s = i.ToString(); // ok
else
// next line doesn't compile: Cannot apply indexing with [] to an expression of type 'T'
int a = i[0];
}

Caller code example:

int a = 5;
function(ref a);
int[] arri = { 3, 5, 7 };
function(ref arri);

Thanks for any help.


AnswerRe: Help with generics Pin
0x3c022-Apr-09 8:35
0x3c022-Apr-09 8:35 
AnswerRe: Help with generics Pin
Thomas Weller22-Apr-09 9:07
Thomas Weller22-Apr-09 9:07 
GeneralRe: Help with generics Pin
GuimaSun22-Apr-09 9:30
GuimaSun22-Apr-09 9:30 
GeneralRe: Help with generics Pin
0x3c022-Apr-09 9:52
0x3c022-Apr-09 9:52 
GeneralRe: Help with generics Pin
GuimaSun22-Apr-09 9:56
GuimaSun22-Apr-09 9:56 
GeneralRe: Help with generics Pin
Thomas Weller22-Apr-09 20:22
Thomas Weller22-Apr-09 20:22 
GeneralRe: Help with generics Pin
0x3c022-Apr-09 9:30
0x3c022-Apr-09 9:30 
Questionpublically readonly but internally writable objects? Pin
student_rhr22-Apr-09 7:43
student_rhr22-Apr-09 7:43 
AnswerRe: publically readonly but internally writable objects? Pin
harold aptroot22-Apr-09 7:49
harold aptroot22-Apr-09 7:49 
AnswerRe: publically readonly but internally writable objects? Pin
Thomas Weller22-Apr-09 8:33
Thomas Weller22-Apr-09 8:33 
AnswerRe: publically readonly but internally writable objects? Pin
0x3c022-Apr-09 8:36
0x3c022-Apr-09 8:36 
QuestionSerialization and ViewState Pin
Fayu22-Apr-09 7:11
Fayu22-Apr-09 7:11 
AnswerRe: Serialization and ViewState Pin
Fayu22-Apr-09 7:25
Fayu22-Apr-09 7:25 
GeneralRe: Serialization and ViewState Pin
OriginalGriff22-Apr-09 9:17
mveOriginalGriff22-Apr-09 9:17 
GeneralRe: Serialization and ViewState Pin
Fayu22-Apr-09 9:33
Fayu22-Apr-09 9:33 
GeneralRe: Serialization and ViewState Pin
OriginalGriff22-Apr-09 21:43
mveOriginalGriff22-Apr-09 21:43 
QuestionJust for fun - how slow are exceptions? Pin
Rob Philpott22-Apr-09 6:12
Rob Philpott22-Apr-09 6:12 

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.