.net - When should I use LINQ for C#? -
I am learning C #, and I find LINQ absolutely interesting. However, what is happening to me, I can not think of a scenario so that the use of LINQ will be a great help, because it does not really work hard in Linux with the code.
Any personal experience / suggestions Thanks!
Thank you!
I think I'm using LINQ at any time about that first one A loop would be written to fill the container. I use SQL for my SECL from LINQ and I use LINQ everywhere.
Here is a small snippet I wrote for an Active Directory helper class that shows that a particular user is a special group to repeat any of the () method to override the user's authorization groups Use the note until there is no one matching SID. More cleaner codes than alternatives.
Private Bull iSGroup (Group Pinnipinal Group, UserPinental User) {if (group == empty; group.Sid == null) {return false; } Return the user Gate Authority Group (). Any (G = & gt; GCD! = Null & G. S.D.Dep.Campreto (Group SID) == 0); }
Optional:
Private boole isInGroup (GroupPrin group, userpin user) {if (group == null || group.Sid == null) { return false; } Bool inGroup = false; Foreign exchange (login in user gate authority group) () = if (g = & gt; gced! = Null & gsid. Com. Comparto (group.sd) == 0) {inGroup = true; break; }} Return to group; }
or
private bool isInGroup (GroupPrin group, UserPrincipal user) {if (group == null || group.Sid == null) { return false; } In foreach (user.GetAuthorizationGroups () var) {if (g = & gt; g.Sid! = Null & amp; g.Sid.CompareTo (group.Sid) == 0) {back true; } } return false; }
This is a snippet that searches against a repository, order, and converts the first 10 messaging business object into a view-specific model ( distance
edit the distance from the unique ID unique ID parameter of Levenshtein's mailing model).
model. Results = this. Repository FindGuestByUniqueID (uniqueID, withExpired). Orderbie (g = & gt; g. Distance). (10). Choose Lists (). Select (G = & gt; New GuestGridModel (g));
Comments
Post a Comment