- 方便代码的交流和维护。
- 不影响编码的效率,不与大众习惯冲突。
- 使代码更美观、阅读更方便。
- 使代码的逻辑更清晰、更易于理解。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| try | |
| { | |
| ProcessStartInfo startInfo = new ProcessStartInfo(); | |
| startInfo.FileName = "WindowsFormsApplication1.exe"; //启动的应用程序名称 | |
| startInfo.Arguments = "我是由控制台程序传过来的参数,如果传多个参数用空格隔开"+" 第二个参数"; | |
| startInfo.WindowStyle = ProcessWindowStyle.Normal; | |
| Process.Start(startInfo); | |
| } | |
| catch (Exception ex) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void SendACommandToAutoCAD(string command) | |
| { | |
| if (MgdApplication.DocumentManager.Count == 0) | |
| { | |
| MessageBox.Show("无活动文档,请新建文档后再执行命令", "新建文档", MessageBoxButtons.OK, MessageBoxIcon.Stop); | |
| return; | |
| } | |
| // 根据是否有命令运行决定esc的数量 | |
| string esc = ""; | |
| string cmds = (string)MgdApplication.GetSystemVariable("CMDNAMES"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private string GetDllPath() | |
| { | |
| string strDLLPath = System.Reflection.Assembly.GetExecutingAssembly().CodeBase; | |
| strDLLPath = strDLLPath.Substring(8); | |
| return strDLLPath.Substring(0, strDLLPath.LastIndexOf("/") + 1); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [DllImport("kernel32", SetLastError = true, CallingConvention = CallingConvention.Winapi)] | |
| public extern static IntPtr LoadLibrary(string libraryName); | |
| [DllImport("kernel32", SetLastError = true, CallingConvention = CallingConvention.Winapi)] | |
| public extern static IntPtr GetProcAddress(IntPtr hwnd, string procedureName); | |
| private delegate bool IsWow64ProcessDelegate([In] IntPtr handle, [Out] out bool isWow64Process); | |
| public static bool IsOS64Bit() | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class Wow | |
| { | |
| public static bool Is64BitProcess | |
| { | |
| get { return IntPtr.Size == 8; } | |
| } | |
| public static bool Is64BitOperatingSystem | |
| { | |
| get |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ACM大量习题题库 | |
| ACM大量习题题库 | |
| 现在网上有许多题库,大多是可以在线评测,所以叫做Online Judge。除了USACO是为IOI准备外,其余几乎全部是大学的ACM竞赛题库。 | |
| USACO | |
| http://ace.delos.com/usacogate | |
| 美国著名在线题库,专门为信息学竞赛选手准备 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class PeekingStreamReader : StreamReader | |
| { | |
| private Queue<string> _peeks; | |
| public PeekingStreamReader(Stream stream) : base(stream) | |
| { | |
| _peeks = new Queue<string>(); | |
| } | |
| public PeekingStreamReader(string path) : base(path) | |
| { | |
| _peeks = new Queue<string>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text; | |
| namespace MVP | |
| { | |
| [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] | |
| public sealed class PresenterBindingAttribute : Attribute | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class EnumLabelAttribute : Attribute | |
| { | |
| public string Label { get; private set; } | |
| public EnumLabelAttribute(string label) { Label = label; } | |
| } | |
| public static class EnumLabelExtension | |
| { | |
| public static string GetLabel(this Enum @enum) | |
| { |
OlderNewer