c#-4.0

How to get maximum Id in List and then return list

好久不见. 提交于 2020-01-06 07:44:35
问题 I have a structure like this: No ID Name Status 1 1 A 1 2 1 B 1 3 1 c 1 4 1 D 1 5 2 E 3 6 2 F 3 7 2 G 3 I want to run a linq when I get a list results get maximum row where for each status and row details as well.Like: No ID Name Status 4 1 D 1 7 2 G 3 Means latest entry for the status. Is there a way around, as I have tried all Max, Orderby descending but I get single result but I need a List as a result. 回答1: You have to extract the groups of a same id (GroupBy), and then export the max No

Use .Net DirectoryServices to Set TTL on Active Directory Group Membership

妖精的绣舞 提交于 2020-01-06 06:48:27
问题 I am using the tools in the .Net System.DirectoryServices.AccountManagement namespace to manage Active Directory groups - group creation, adding users to groups, removing users from group, etc. Here's some code that shows what I'm doing right now... -- group creation // connect to our organizational unit on the production Active Directory Server using (PrincipalContext principalCtx = new PrincipalContext(ContextType.Domain, s_prodAdServerName, s_ouPath)) { // create group with necessary

How to listen to the scrolling event of scrollviewer in windows phone 8?

大憨熊 提交于 2020-01-06 04:18:45
问题 I have developed for windows 8/8.1. Its scrollviewer generates events while scrolling like - ViewChanging/ViewChanged. I couldn't find any such event for scrollviewer in windows phone 8. How can i listen to when the scrollviewer is scrolling in WP8? I am trying to look for method similar to -ScrollViewDidScroll() of iOS development. 回答1: Have tried to use this event? - ScrollViewer.ViewChanged event 回答2: If you are using a ScrollViewer, or a ListBox you can listen to the LayoutUpdated event

How to use SQL's LIKE on a guid in Entity Framework?

China☆狼群 提交于 2020-01-06 04:17:47
问题 In SQL Server, uniqueidentifier columns can be used like strings with the LIKE comparison: SELECT * FROM dbo.Table WHERE GuidColumn LIKE '4c38e01e%' How can I use this feature in Entity Framework? I want something like this context.Table.Where(x => x.StringColumn.Contains("some string")) but for a Guid column instead for string columns: context.Table.Where(x => x.GuidColumn ???? "4c38e01e") 回答1: As far as I know there is no way to convert Guid to string on the fly in EntityFramework. I'm

Pipe console.writeLine() messages to a text file

感情迁移 提交于 2020-01-06 04:08:27
问题 I wonder what the best approach is in implementing a logger which essentially eats all Console.WriteLine() messages and spits out a text file of all these messages. I know I could use a StringBuilder and populate it with all the messages by doing .AppendLine wherever Console.WriteLine occurs...but I am looking for something more magical than that. Some way using which I don't have to write as many lines of code as Console.WriteLine s in existing code. And in case you missed the tags, this is

How to set/access outlook DoNotForward property in Microsoft exchange service

给你一囗甜甜゛ 提交于 2020-01-06 03:45:31
问题 Option I want to use when sending the email is accessed in outlook. Permission option I need to set Do not forward permission of EmailMessage object in Microsoft exchange service code but I am not able to set it to true. ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack; ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2); service.Credentials = new WebCredentials("abc", "xyz", "bbb"); service.AutodiscoverUrl("xyz@abc.com",

How to set/access outlook DoNotForward property in Microsoft exchange service

拜拜、爱过 提交于 2020-01-06 03:45:25
问题 Option I want to use when sending the email is accessed in outlook. Permission option I need to set Do not forward permission of EmailMessage object in Microsoft exchange service code but I am not able to set it to true. ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack; ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2); service.Credentials = new WebCredentials("abc", "xyz", "bbb"); service.AutodiscoverUrl("xyz@abc.com",

how to get substring or part of string from a url in c#

守給你的承諾、 提交于 2020-01-06 03:32:06
问题 I have an application where uses post comments. Security is not an issue. string url = http://example.com/xyz/xyz.html?userid=xyz&comment=Comment What i want is to extract the userid and comment from above string. I tried and found that i can use IndexOf and Substring to get the desired code BUT what if the userid or comment also has = symbol and & symbol then my IndexOf will return number and my Substring will be wrong. Can you please find me a more suitable way of extracting userid and

Is directshow.net video input device filter enumeration broken (in newer environments)?

随声附和 提交于 2020-01-06 03:06:32
问题 Every example in the directshow.net samples folder (marked "2010-February") compiles fine, and those that play videos from files work great. However, every example that tries to enumerate the FilterCategory.VideoInputDevices always fails to find any of my filters, specifically DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice); always returns that I have no devices. This same problem occurs for me in every other program that uses directshow.net, like touchless and the various examples

Navigating to different views without reloading entire page

不问归期 提交于 2020-01-06 02:51:51
问题 I have a layout page that has one dropdown box. I created 3 views that will make use of this layout. The value selected in the dropdown will be used in all 3 views created. I have actionlinks used for navigation in the layout. Here is what I will like to achieve Avoid reloading the entire page(layout) when I navigate from view to view since I want to keep the dropdown value selected. How can I achieve this such that it is only the content of the views that will be changing when I navigate