Click here to Skip to main content
15,880,608 members
Home / Discussions / C#
   

C#

 
GeneralRe: Undo Redo option? Pin
azusakt22-Apr-04 16:40
azusakt22-Apr-04 16:40 
GeneralRe: Undo Redo option? Pin
Christian Graus22-Apr-04 16:45
protectorChristian Graus22-Apr-04 16:45 
GeneralRe: Undo Redo option? Pin
«_Superman_»22-Apr-04 23:43
professional«_Superman_»22-Apr-04 23:43 
AnswerRe: Undo Redo option? Pin
Heath Stewart23-Apr-04 2:48
protectorHeath Stewart23-Apr-04 2:48 
Generalconvert C# code to FORTRAN 95 Pin
jackconnolly22-Apr-04 16:01
jackconnolly22-Apr-04 16:01 
GeneralRe: convert C# code to FORTRAN 95 Pin
hammackj22-Apr-04 17:16
hammackj22-Apr-04 17:16 
GeneralRe: convert C# code to FORTRAN 95 Pin
Dave Kreskowiak23-Apr-04 0:35
mveDave Kreskowiak23-Apr-04 0:35 
Generalsscanf in c# / passing variable number of arguments Pin
Anonymous22-Apr-04 14:31
Anonymous22-Apr-04 14:31 
I am trying to write a crude version of c#.The fn. looks like this:

static void sscanf(string input, string format, params object[] paramlist)
{
string pattern = @"\b\S+\b";
MatchCollection matches1 = Regex.Matches(input, pattern);
MatchCollection matches2 = Regex.Matches(format, @"\b\S+\b");
for(int i = 0; i < matches1.Count; i++)
{
if (matches2[i].Value == "s")
paramlist[i] = matches1[i].Value;
else if (matches2[i].Value == "d")
{
try
{
int ii = int.Parse(matches1[i].Value);
paramlist[i] = ii;
}
catch (Exception exc)
{
Console.WriteLine(exc.Message);
}
}
else if (matches2[i].Value == "f" || matches2[i].Value == "lf")
{
try
{
double dd = double.Parse(matches1[i].Value);
paramlist[i] = dd;
}
catch (Exception exc)
{
Console.WriteLine(exc.Message);
}
}
}
}

and can be called for example as:

sscanf(str, "%s %s %lf %lf %d", os1, os2, od1, od2, oi1);

The problem I am facing is that the variables are being passed by value not by reference. Can anyone please help me? the c# compiler does not allow me to use the keyword ref in conjunction with params.

The cause of the problem - It seems to me is that object is not a reference type. This is how I tested:


say we have a fn. fn1 like:

static void fn1(object obj)
{
int i = 10;
obj = i;
}

now in main:

int i = 0;
object obj = new object();
obj = i;
fn1();
i = (int) obj;

i remains as 0 instead of 10.

pl. mail me at fd97207 yahoo if you know the answer.
GeneralRe: sscanf in c# / passing variable number of arguments Pin
Heath Stewart23-Apr-04 2:54
protectorHeath Stewart23-Apr-04 2:54 
GeneralAsserts in release builds Pin
Anders Molin22-Apr-04 10:30
professionalAnders Molin22-Apr-04 10:30 
GeneralRe: Asserts in release builds Pin
Heath Stewart22-Apr-04 11:18
protectorHeath Stewart22-Apr-04 11:18 
GeneralRe: Asserts in release builds Pin
Anders Molin22-Apr-04 11:22
professionalAnders Molin22-Apr-04 11:22 
GeneralRe: Asserts in release builds Pin
Heath Stewart22-Apr-04 11:36
protectorHeath Stewart22-Apr-04 11:36 
GeneralRe: Asserts in release builds Pin
Anders Molin22-Apr-04 12:01
professionalAnders Molin22-Apr-04 12:01 
Generalscanner Pin
cmarmr22-Apr-04 10:15
cmarmr22-Apr-04 10:15 
GeneralRe: scanner Pin
Dimitris Iliopoulos22-Apr-04 10:52
Dimitris Iliopoulos22-Apr-04 10:52 
GeneralOpen an URL and get an URL Pin
olreit22-Apr-04 9:38
olreit22-Apr-04 9:38 
GeneralRe: Open an URL and get an URL Pin
Heath Stewart22-Apr-04 9:51
protectorHeath Stewart22-Apr-04 9:51 
GeneralExtrending properties - version - other version information dialog Pin
DavidNohejl22-Apr-04 9:33
DavidNohejl22-Apr-04 9:33 
GeneralRe: Extrending properties - version - other version information dialog Pin
Heath Stewart22-Apr-04 9:47
protectorHeath Stewart22-Apr-04 9:47 
GeneralRe: Extrending properties - version - other version information dialog Pin
DavidNohejl23-Apr-04 7:02
DavidNohejl23-Apr-04 7:02 
GeneralRe: Extrending properties - version - other version information dialog Pin
Heath Stewart23-Apr-04 7:19
protectorHeath Stewart23-Apr-04 7:19 
GeneralRe: Extrending properties - version - other version information dialog Pin
DavidNohejl24-Apr-04 5:05
DavidNohejl24-Apr-04 5:05 
GeneralConfiguration Files Pin
BrianEllis22-Apr-04 9:29
BrianEllis22-Apr-04 9:29 
GeneralRe: Configuration Files Pin
Heath Stewart22-Apr-04 9:46
protectorHeath Stewart22-Apr-04 9:46 

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.