.net-4.5

C# Linq to CSV Dynamic Object runtime column name

帅比萌擦擦* 提交于 2020-01-02 15:09:36
问题 I'm new to using Dynamic Objects in C#. I am reading a CSV file very similarly to the code found here: http://my.safaribooksonline.com/book/programming/csharp/9780321637208/csharp-4dot0-features/ch08lev1sec3 I can reference the data I need with a static name, however I can not find the correct syntax to reference using a dynamic name at run time. For example I have: var records = from r in myDynamicClass.Records select r; foreach(dynamic rec in records) { Console.WriteLine(rec.SomeColumn); }

How to correct write test with async methods?

末鹿安然 提交于 2020-01-02 14:33:27
问题 I have class for iterating images. public class PictureManager { private int _current; public List<BitmapImage> _images = new List<BitmapImage>(5); public static string ImagePath = "dataImages"; public async void LoadImages() { _images = await GetImagesAsync(); } public async Task<List<BitmapImage>> GetImagesAsync() { var files = new List<BitmapImage>(); StorageFolder picturesFolder = await KnownFolders.PicturesLibrary.GetFolderAsync("dataImages"); IReadOnlyList<IStorageItem> itemsList =

How to correct write test with async methods?

筅森魡賤 提交于 2020-01-02 14:32:02
问题 I have class for iterating images. public class PictureManager { private int _current; public List<BitmapImage> _images = new List<BitmapImage>(5); public static string ImagePath = "dataImages"; public async void LoadImages() { _images = await GetImagesAsync(); } public async Task<List<BitmapImage>> GetImagesAsync() { var files = new List<BitmapImage>(); StorageFolder picturesFolder = await KnownFolders.PicturesLibrary.GetFolderAsync("dataImages"); IReadOnlyList<IStorageItem> itemsList =

How to correct write test with async methods?

我与影子孤独终老i 提交于 2020-01-02 14:31:45
问题 I have class for iterating images. public class PictureManager { private int _current; public List<BitmapImage> _images = new List<BitmapImage>(5); public static string ImagePath = "dataImages"; public async void LoadImages() { _images = await GetImagesAsync(); } public async Task<List<BitmapImage>> GetImagesAsync() { var files = new List<BitmapImage>(); StorageFolder picturesFolder = await KnownFolders.PicturesLibrary.GetFolderAsync("dataImages"); IReadOnlyList<IStorageItem> itemsList =

Search for specific file name in directory

六眼飞鱼酱① 提交于 2020-01-02 10:24:15
问题 I'm trying to search for specific file name on all volumes on the system, except System Volume Information or Windows Directories and print out every full path for each file. I've tried to use Directory.GetFiles , but it only searche inside Drive C:\ or Drive D:\ (depends which drive is specified) How can I achieve my goal? For example I want to run program and search for file with name ".DS_Store" (used to use mac, and now my file system is full of these files....) I would really appreciate

is there something like dbgeometry makevalid in .net 4.5

点点圈 提交于 2020-01-02 08:24:42
问题 I'm trying to calculate area of polyline like that string poly = "POLYGON ((637604.918432772 2230520.64934531, 637622.257266129 2230419.44632915, 637279.107128549 2230192.04910755, 636765.470527745 2230179.6468564, 636778.005055813 2229861.77192838, 636529.81646905 2229464.29327025, 635813.486592791 2229523.30345774, 636017.385069448 2229974.32341381, 636267.323659164 2230070.32127916, 637035.026966561 2230404.70764784, 637275.265066307 2230401.13408429, 637604.918432772 2230520.64934531,

Bad Request error using SendGrid SMTP email submission

夙愿已清 提交于 2020-01-02 05:32:33
问题 I am currently using C# in MVC4 ASP.NET 4.5. My application creates a user and then submits a registration email to that use to authenticate their email. To create this script, I followed this tutorial: How to Send Email Using SendGrid with Windows Azure I am using the latest version of SendGrid (2.1.1) Code specific namespaces being used: using SendGridMail; using System.Net; using System.Net.Mail; Here is my code that creates the SendGrid mail message: SendGrid message = SendGrid

Dependency on the framework assembly “System.Runtime, Version=4.0.10.0,” which could not be resolved in the currently targeted framework

对着背影说爱祢 提交于 2020-01-02 02:40:28
问题 TFS 2013 - Build: ASP.Net 4.5.1 website I get this error: warning MSB3268: The primary reference "C:\Builds\2\MyProj\Web1_Main\bin\MyProj1.dll" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.5.1". To resolve this problem, either remove the reference "C:\Builds\2\MyProj\Web1_Main

Can a Dapper DynamicParameters object be enumerated like a dictionary of parameters?

浪尽此生 提交于 2020-01-02 01:13:10
问题 I know I can use a ParameterDirection with Dapper.DynamicParameters: var parameters = new DynamicParameters(); parameters.Add("iparam", 42); parameters.Add("oparam", null, DbType.Int32, ParameterDirection.Output); connection.Execute(sql, parameters); But can I do so when using a Dictionary<string, object> ? var parameters = new Dictionary<string, object>(); parameters.Add("iparam", 42); parameters.Add("oparam", /* ??? */ ); connection.Execute(sql, parameters); Alternatively, how may I iterate

New HttpClient proxy settings issues

走远了吗. 提交于 2020-01-01 18:17:28
问题 I'm trying to rewrite old network authentication logic according to new fw 4.5 features such as HttpClient and await/async and i experience unexpected latency (around 15s) between request and response. My guess is that happens because client tries to find/use proxy from IE like it was with old HttpRequest/WebClient. Here's the code : public static async Task<AuthResult> GetDataFromServiceAsync(string url, string login, string password) { Debug.WriteLine("[" + DateTime.Now + "]