Can you be more specific about what you would like to do with the remainder? Currently the statement you have uses modulo division, which will give you your remainder after division :
int mod1 = 14 % 12; //yields 2
int mod2 = 4 % 5: //yields 1
int mod3 = 10 % 7; //yields 3
Modulo divisionis a common operation in development and you certainly don't need LINQ to use it. You could use it in LINQ statements as you would any other numerical values. An example using it would be to get all of the objects in a sequence that are odd numbers :
int[] numbers = new int[]{ 3, 4, 5, 6, 7, 8 };
var primes = numbers.Where(n => n % 2 == 1); //yields { 3, 5, 7 }
lvasquez20
0 Points
16 Posts
Residue Division in Linq
Jan 23, 2013 10:43 PM|LINK
can somebody to tell me how i can use the residue for a division in Linq?
for example this sentence in sql server
to linq, i will apreciate the help
Rion William...
All-Star
27394 Points
4542 Posts
Re: Residue Division in Linq
Jan 24, 2013 02:25 AM|LINK
Can you be more specific about what you would like to do with the remainder? Currently the statement you have uses modulo division, which will give you your remainder after division :
Modulo division is a common operation in development and you certainly don't need LINQ to use it. You could use it in LINQ statements as you would any other numerical values. An example using it would be to get all of the objects in a sequence that are odd numbers :
int[] numbers = new int[]{ 3, 4, 5, 6, 7, 8 }; var primes = numbers.Where(n => n % 2 == 1); //yields { 3, 5, 7 }