please help when compile error cs0266

budhiastra

New Member
please help
I created the following code

sub run
regobj.new1(false)
regex1.new(",")
regobj.fromlibrary("main.regex1","reg",b4pobject(2))
str="0,1,2"
a()=regobj.runmethod2("split",str,"system.string")
msgbox(a(2))
end sub

when i run the results = 2
when i compile the results = error cs0266
what is wrong?

Thx u before
 

mjcoon

Well-Known Member
Licensed User
Are you not doing "the hard way" what you could do with:
B4X:
a() = StrSplit(str, ",")

Which would require no DLLs and no objects.

Mike.
 

agraham

Expert
Licensed User
Longtime User
what is wrong?
For information. The error occurs because RunMethod2 is declared to return an Object and the compiler sees that it is being assigned to a String[] without a cast. The IDE can cope with this as it check for the actual type of the return value but in the generated C# code the return value is statically typed as an Object and gives that error.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…