Hi there
I have a class.
public class MedicalRequest
{
private int id
private IList<MedicalDays> Days
private string MedicalUser
...
}
and another
public class MedicalDays
{
private int id;
private DateTime? day
private MedicalRequest request
...
}
I'm using nhibernate to return a list of all t...
i have func
public PageOfList<ConsaltQuestion> Filter(int? type, int pageId, EntityCollection<ConsaltCost> ConsaltRoles)
{
// return _dataContext.ConsaltQuestion.Where((o => o.Type == type || type == null) && (o=>o.Paid == paid));
return (from i in _dataContext.ConsaltQuestion where ((i.Type == type || type == null) &...
So I've just started working with linq as well as using lambda expressions. I've run into a small hiccup while trying to get some data that I want. This method should return a list of all projects that are open or in progress from Jira
Here's the code
public static List<string> getOpenIssuesListByProject(string _projectName)
{...
I have a class with a property of type Expression> and I want to set this property with a string like "m => m.A + m.B = m.C".
If I write this as new Type(){propertyName = m => m.A + m.B = m.C} sets this property to a true return.
I want to be able to do this:
string s = "m => m.A + m.B = m.C";
Type<T> t = new Type<T>(){propertyName =...
I'm trying to get a simple delete every pointer in my vector/list/... function written with an ultra cool lambda function. Mind you, I don't know c**p about those things :)
template <typename T>
void delete_clear(T const& cont)
{
for_each(T.begin(), T.end(), [](???){ ???->delete() } );
}
I have no clue what to fill in for the ???'...
I have a method Get on a type MyType1 accepting a Func<MyType2, bool> as a parameter.
An example of its use:
mytype1Instance.Get(x => x.Guid == guid));
I would like create a stub implementation of the method Get that examines the incoming lambda expression and determines what the value of guid is. Clearly the lambda could be "anythin...
Ok, maybe the title isn't the most descriptive thing in the world, but this problem is killing me. What I'm trying to do is create an ActionLinkFor helper method, like so:
public ActionResult Index()
{
// Does Stuff
}
public ActionResult SomeAction(int param1)
{
// Does Stuff
}
These are two action methods. Action methods can h...
In SubSonic 3.04's SimpleRepository, I cannot seem to perform a Contains operation within a lambda expression. Here's a trivial example:
SimpleRepository repo = new SimpleRepository("ConnectionString");
List<int> userIds = new List<int>();
userIds.Add(1);
userIds.Add(3);
List<User> users = repo.Find<User>(x => userIds.Contains(x.Id))...
I'm not sure I like linq query syntax...its just not my preference. But I don't know what this query would look like using lambda expressions, can someone help?
from securityRoles in user.SecurityRoles
from permissions in securityRoles.Permissions
where permissions.SecurableEntity.Name == "Unit" && permissions.PermissionType.Name == "R...
I need to test a logical expression held in a string to see if it evaluate to TRUE or FALSE.(the strig is built dynamically)
For example the resulting string may contain "'dog'<'cat' OR (1>4 AND 4<6)". There are no variables in the string, it will logically evaluate. It will only contain simple operators = > < >< >= <= and AND , OR and O...
I've started to use Javascript a lot more, and as a result I am writing things complex enough that organization is becoming a concern. However, this question applies to any language that allows you to nest functions. Essentially, when should you use an anonymous function over a named global or inner function?
At first I thought it was t...
I currently have a log object I'd like to remove objects from, based on a LINQ query. I would like to remove all records in the log if the sum of the versions within a program are greater than 60. Currently I'm pretty confident that this'll work, but it seems kludgy:
for (int index = 0; index < 4; index++)
{
Lo...
How do the Lambda Expressions / Closures in C++0x complicate the memory management in C++? Why do some people say that closures have no place in languages with manual memory management? Is their claim valid and if yes, what are the reasons behind it?
...
Using C++0x, how do I capture a variable when I have a lambda within a lambda? For example:
std::vector<int> c1;
int v = 10; <--- I want to capture this variable
std::for_each(
c1.begin(),
c1.end(),
[v](int num) <--- This is fine...
{
std::vector<int> c2;
std::for_each(
c2.begin(),
...
Hey,
In SICP 1.2.1 there is a function that makes a rational number, as follow:
(define (make-rat n d)
(let ((g (gcd n d)))
(cons (/ n g) (/ d g))))
I'm just curious how you can implement the same thing using lambda instead of let, without calling GCD twice. I couldn't figure it out myself.
...
Is it possible a lambda function to have variable number of arguments?
For example, I want to write a metaclass, which creates a method for every method of some other class and this newly created method returns the opposite value of the original method and has the same number of arguments.
And I want to do this with lambda function. How...
I'm new to lambda expressions and looking to leverage the syntax to set the value of one property in a collection based on another value in a collection
Typically I would do a loop:
class Item
{
public string Name { get; set; }
public string Value { get; set; }
}
void Run()
{
Item item1 = new Item { Name = "name1" };
I...
hey,
I have two-dimension array
List<List<int>> boardArray
How can I enumerate throw this array to check that it contains other value than 0 ?
I think about boardArray.Contains and ForEach ,cause it return bool value but I don't have too much experience with lambda expression :/
Please help :)
...
Hello All,
I have an IEnumerable<someClass>. I need to transform it into XML. There is a property called 'ZoneId'. I need to write some XML based on this property, then I need some decendent elements that provide data relevant to the ZoneId. I know I need some type of grouping. Here's what I have attempted thus far without much success. ...
Hey, I'm very new to linq and lamba expressions. I'm trying to walk a collection, and when I find an item that meets some criteria I'd like to add that to another separate collection.
My linq to walk the collection looks like this (this works fine):
From i as MyCustomItem In MyCustomItemCollection Where i.Type = "SomeType" Select i
I...