D
dpriver
I have to initialize a huge constant array of structures(60000~100000),
used as a lookup table , but it failed with
System.InvalidProgramException
when the items reach 18400. and if I change the item type from struct
to class,
the threshold is 35000 . It seems that there a size limition when
initialize constant in CLR.
Is there any configurable parameters can be used to increase this
limition in C# compiler
or .NET framework. Or I'm missing something there?
using System;
struct st
{
public short t1,t2 ;
public st(short t1,short t2){
this.sym = t1;
this.act = t2;
}
}
class Test{
static void Main(){
st[] a = {
new st(3,4),
new st(3,4),
new st(3,4),
new st(3,4),
new st(3,4),
new st(3,4),
new st(1,2),
...
...
repeated more than 20000 times
...
...
...
new st(3,4),
new st(1,2),
new st(1,2),
new st(3,4),
new st(1,2),
new st(1,2),
new st(3,4)
};
Console.WriteLine("{0}",a[1].t1);
}
}
used as a lookup table , but it failed with
System.InvalidProgramException
when the items reach 18400. and if I change the item type from struct
to class,
the threshold is 35000 . It seems that there a size limition when
initialize constant in CLR.
Is there any configurable parameters can be used to increase this
limition in C# compiler
or .NET framework. Or I'm missing something there?
using System;
struct st
{
public short t1,t2 ;
public st(short t1,short t2){
this.sym = t1;
this.act = t2;
}
}
class Test{
static void Main(){
st[] a = {
new st(3,4),
new st(3,4),
new st(3,4),
new st(3,4),
new st(3,4),
new st(3,4),
new st(1,2),
...
...
repeated more than 20000 times
...
...
...
new st(3,4),
new st(1,2),
new st(1,2),
new st(3,4),
new st(1,2),
new st(1,2),
new st(3,4)
};
Console.WriteLine("{0}",a[1].t1);
}
}