.net-3.5

Parsing command-line options in C# [duplicate]

喜夏-厌秋 提交于 2021-02-18 17:10:47
问题 This question already has answers here : Best way to parse command line arguments in C#? [closed] (20 answers) Closed 3 years ago . I've seen people write custom classes to more easily handle command line options in various languages. I wondered if .NET (3.5 or lower) has anything built in so that you don't have to custom-parse things like: myapp.exe file=text.txt 回答1: Here is another possible approach. Very simple but it has worked for me in the past. string[] args = {"/a:b", "/c:", "/d"};

Enum helper in c# not giving expected result

℡╲_俬逩灬. 提交于 2021-02-16 20:18:22
问题 Basically I am not recieving the correct enum type for some reason and I cannot figure out why, my code is below, many thanks in advance for any pointers/ explanation... EDIT: type-> changed to anothername (thanks guys for the heads up) Helper: public static T Convert<T>(this string str) { return (T)Enum.Parse(typeof(T), str, true); } Enum values: public enum anothername { SmallText = 100, Number = 15, TextArea = 0, Bool = 0, Choices = 0, } My test: [Test] public void

A hostname with Unicode characters is valid in Windows 8

╄→尐↘猪︶ㄣ 提交于 2021-02-10 05:43:27
问题 Uri.CheckHostName("контосо.ком") returns UriHostNameType.Unknown everywhere, but on Windows 8, where it returns UriHostNameType.Dns . Any ideas why all of a sudden a hostname with Unicode/Cyrillic characters is valid in Windows 8? 回答1: Because of this. Internationalized domain name http://en.wikipedia.org/wiki/Internationalized_domain_name http://tools.ietf.org/html/rfc5895 来源: https://stackoverflow.com/questions/14075023/a-hostname-with-unicode-characters-is-valid-in-windows-8

can i call a .net 2.0 dll in .net 3.5?

送分小仙女□ 提交于 2021-02-08 17:04:36
问题 I am migrating to .net 3.5 and I want to know whether I can call from my 3.5 application, old .net 2.0 dll's methods? Some external API's are in .net 2.0 dll. So I need those. Kindly let me know. Thanks. 回答1: Yes. You can do that. 回答2: .NET 3.5 is nothing more than .NET 2.0 SP2 with some additional assemblies. This means that .NET 3.5 is .NET 2.0, to a large extent. 回答3: Yes, .NET remains compatible with old versions. There might be some obsolete code but it will still work. Only before 2.0

can i call a .net 2.0 dll in .net 3.5?

被刻印的时光 ゝ 提交于 2021-02-08 16:58:59
问题 I am migrating to .net 3.5 and I want to know whether I can call from my 3.5 application, old .net 2.0 dll's methods? Some external API's are in .net 2.0 dll. So I need those. Kindly let me know. Thanks. 回答1: Yes. You can do that. 回答2: .NET 3.5 is nothing more than .NET 2.0 SP2 with some additional assemblies. This means that .NET 3.5 is .NET 2.0, to a large extent. 回答3: Yes, .NET remains compatible with old versions. There might be some obsolete code but it will still work. Only before 2.0

Saving WPF bitmap effect resultant image

。_饼干妹妹 提交于 2021-02-08 07:26:41
问题 I have a image to be displayed in the page and then apply some visual effects to the image. e.g Bevel effect. Once the effect is applied successfully is there a way to save the resultant image? 回答1: you can do something like this private void SaveImage() { try { SaveFileDialog saveDialog = new SaveFileDialog(); saveDialog.Filter = "JPeg Image(*.JPG)|*.jpg|Bitmap Image(*.BMP)|*.bmp|Png Image(*.PNG)|*.png|Gif Image(*.GIF)|*.gif"; if (saveDialog.ShowDialog().Value == true) { // Save current

Saving WPF bitmap effect resultant image

你离开我真会死。 提交于 2021-02-08 07:26:22
问题 I have a image to be displayed in the page and then apply some visual effects to the image. e.g Bevel effect. Once the effect is applied successfully is there a way to save the resultant image? 回答1: you can do something like this private void SaveImage() { try { SaveFileDialog saveDialog = new SaveFileDialog(); saveDialog.Filter = "JPeg Image(*.JPG)|*.jpg|Bitmap Image(*.BMP)|*.bmp|Png Image(*.PNG)|*.png|Gif Image(*.GIF)|*.gif"; if (saveDialog.ShowDialog().Value == true) { // Save current

FormView ConvertEmptyStringToNull and binding

痴心易碎 提交于 2021-02-07 14:46:44
问题 I'm using a FormView with an ObjectDataSource and binding using <%# Bind("WhateverProp") %> - and all of my nullable columns are coming back with default values of the type in them. It appears that the FormView object doesn't have a ConvertEmtpyStringToNull property like the other binding containers do. I've found articles suggesting that this was a bug in VS 2005 / .Net 2.0 - but don't see any saying what the resolution was. Does anyone have any suggestions as to how I can work around this

FormView ConvertEmptyStringToNull and binding

眉间皱痕 提交于 2021-02-07 14:44:27
问题 I'm using a FormView with an ObjectDataSource and binding using <%# Bind("WhateverProp") %> - and all of my nullable columns are coming back with default values of the type in them. It appears that the FormView object doesn't have a ConvertEmtpyStringToNull property like the other binding containers do. I've found articles suggesting that this was a bug in VS 2005 / .Net 2.0 - but don't see any saying what the resolution was. Does anyone have any suggestions as to how I can work around this

Simplest way to perform data validation for fields on Windows Forms

試著忘記壹切 提交于 2021-02-07 13:42:00
问题 I have a windows form project in which I want to force the user to enter values in certain fields before he presses the calculate button at the bottom. The fields include three pairs of radio buttons , five text boxes and one combo box . So basically all these fields need to contain a value in order to perform the calculations. Additionally, the text boxes should contain numbers - any double values. Moreover, I want to set a maximum value set for most of these text boxes which the user cannot