M
Marco Segurini
Hi,
I have written the following code:
// start code
using System;
using System.Collections.Generic;
using System.Text;
namespace MyPredicates
{
static class MyPredicate
{
public static bool Zero(int val)
{
return val == 0;
}
}
class Program
{
static void Main(string[] args)
{
int[] aTmp = new int[] { 0, 0, 33, 0, 0, 22, 0, 0, 12};
foreach(int i in aTmp)
Console.Write(i.ToString() + ',');
Console.WriteLine();
Console.WriteLine(System.Array.FindLastIndex(aTmp,
MyPredicate.Zero));
}
}
}
// end code
Now I'd like to perform a FindLastIndex but with MyPredicate.Zero
negate, something like:
Console.WriteLine(System.Array.FindLastIndex(aTmp, !MyPredicate.Zero));
How may I compound (better if inplace) the logical not and
MyPredicate.Zero to get a valid predicate?
TIA.
Marco.
I have written the following code:
// start code
using System;
using System.Collections.Generic;
using System.Text;
namespace MyPredicates
{
static class MyPredicate
{
public static bool Zero(int val)
{
return val == 0;
}
}
class Program
{
static void Main(string[] args)
{
int[] aTmp = new int[] { 0, 0, 33, 0, 0, 22, 0, 0, 12};
foreach(int i in aTmp)
Console.Write(i.ToString() + ',');
Console.WriteLine();
Console.WriteLine(System.Array.FindLastIndex(aTmp,
MyPredicate.Zero));
}
}
}
// end code
Now I'd like to perform a FindLastIndex but with MyPredicate.Zero
negate, something like:
Console.WriteLine(System.Array.FindLastIndex(aTmp, !MyPredicate.Zero));
How may I compound (better if inplace) the logical not and
MyPredicate.Zero to get a valid predicate?
TIA.
Marco.