.net-2.0

Run C# windows application in windows XP without installing .NET Framework [duplicate]

梦想与她 提交于 2020-01-16 06:32:19
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Running .net based application without .NET Framework Hello. Please let me know how I can run C# windows application in Windows XP without installing .NET Framework? 回答1: C# apllication not handled by operating System. Its CLR(inside framework) who take care to run the C# apps and all memory management, resource allocation, de-allocation etc. It create a virtual layer over OS while runnign its application. So

Task failed because “LC.exe” was not found after upgrade to Windows 8.1

回眸只為那壹抹淺笑 提交于 2020-01-14 01:43:28
问题 i have an error building my Visual Studio 2005 after i upgrade my windows 8 to windows 8.1 here's the error. Task failed because "LC.exe" was not found, or the .NET Framework SDK v2.0 is not installed. The task is looking for "LC.exe" in the "bin" subdirectory beneath the location specified in the SDKInstallRootv2.0 value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework. You may be able to solve the problem by doing one of the following: 1.) Install the .NET Framework

Does a class need to implement IDisposable when all members are explicitly disposed?

﹥>﹥吖頭↗ 提交于 2020-01-13 19:59:27
问题 Trying to understand when implementation of IDisposable is necessary: I wrote a little example. public class FileManager { private FileStream fileStream; public void OpenFile(string path) { this.fileStream = File.Open(path, FileMode.Open, FileAccess.Read); } public void CloseFile(string path) { if ( this.fileStream != null && this.fileStream.CanRead) { this.fileStream.Close(); } this.fileStream.Dispose(); } } // client var manager = new FileManager(); manager.Open("path"); manager.Close("path

Can we add parameter in datatable.select in c#

老子叫甜甜 提交于 2020-01-12 08:38:50
问题 I like to know is it possible to add parameter in datatable.select(expression).For example string query="Name=@Name"; //dt is comming from database. dt.Select(query); How to add this parameter @Name . I need to compare a value which contains single quote and it gets failed in the above case. Thanks in advance 回答1: You can use String.Format , you need to escape single quotes with two: string query = string.Format("Name='{0}'", name.Replace(@"'", "''")); var rows = dt.Select(query); or, if you

Can we add parameter in datatable.select in c#

℡╲_俬逩灬. 提交于 2020-01-12 08:38:24
问题 I like to know is it possible to add parameter in datatable.select(expression).For example string query="Name=@Name"; //dt is comming from database. dt.Select(query); How to add this parameter @Name . I need to compare a value which contains single quote and it gets failed in the above case. Thanks in advance 回答1: You can use String.Format , you need to escape single quotes with two: string query = string.Format("Name='{0}'", name.Replace(@"'", "''")); var rows = dt.Select(query); or, if you

What's the best way to instantiate a generic from its name?

落爺英雄遲暮 提交于 2020-01-11 10:11:15
问题 Assuming I have only the class name of a generic as a string in the form of "MyCustomGenericCollection(of MyCustomObjectClass)" and don't know the assembly it comes from, what is the easiest way to create an instance of that object? If it helps, I know that the class implements IMyCustomInterface and is from an assembly loaded into the current AppDomain. Markus Olsson gave an excellent example here, but I don't see how to apply it to generics. 回答1: Once you parse it up, use Type.GetType

What's the best way to instantiate a generic from its name?

不想你离开。 提交于 2020-01-11 10:11:07
问题 Assuming I have only the class name of a generic as a string in the form of "MyCustomGenericCollection(of MyCustomObjectClass)" and don't know the assembly it comes from, what is the easiest way to create an instance of that object? If it helps, I know that the class implements IMyCustomInterface and is from an assembly loaded into the current AppDomain. Markus Olsson gave an excellent example here, but I don't see how to apply it to generics. 回答1: Once you parse it up, use Type.GetType

How to speed up dumping a DataTable into an Excel worksheet?

孤者浪人 提交于 2020-01-09 19:23:26
问题 I have the following routine that dumps a DataTable into an Excel worksheet. private void RenderDataTableOnXlSheet(DataTable dt, Excel.Worksheet xlWk, string [] columnNames, string [] fieldNames) { // render the column names (e.g. headers) for (int i = 0; i < columnNames.Length; i++) xlWk.Cells[1, i + 1] = columnNames[i]; // render the data for (int i = 0; i < fieldNames.Length; i++) { for (int j = 0; j < dt.Rows.Count; j++) { xlWk.Cells[j + 2, i + 1] = dt.Rows[j][fieldNames[i]].ToString(); }

Anonymous interface implementation

佐手、 提交于 2020-01-09 11:59:13
问题 I´ve read 'C# anonymously implement interface (or abstract class)' thread for implementing an interface anonymously. But I wondered if this is also possible using .NET 2.0 (NO LINQ) using delegates or any similar approach. I know from JAVA the following possible: MyClass m = MyMethod(new MyInterface() { @override public void doSomething() {...} } (I hope I remember well, is a time ago that I used JAVA, but I suppose it was something similar). This might be helpful whenever a method needs an

Restricting access to a website by IP address range / domain

懵懂的女人 提交于 2020-01-06 07:20:31
问题 I would like advice on the best way to restrict access to a weba pplication (using .net 2.0 and II6) based on the clients IP address. The two ways I am considering: 1) Through the server side code - check the client I.P against a list of IP addresses within the web.config. 2) Through IIS by creating a virtual directory and restricting the I.P addresses on this virtual directory. My question is if I go the virtual directory route there are a lot of users that access this website and I have