C#プリンタとシリアルポートの取得


/// <summary>
        ///            
        /// </summary>
        /// <returns></returns>
        public string GetPrinter()
        {
            string strList = "";
            System.Drawing.Printing.PrinterSettings.StringCollection PrinterList = System.Drawing.Printing.PrinterSettings.InstalledPrinters;
            foreach (var item in PrinterList)
            {
                strList += item + ",";
            }
            return strList;
        }


        /// <summary>
        ///        
        /// </summary>
        /// <returns></returns>
        public string GetDefault() 
        {
            System.Drawing.Printing.PrintDocument p = new System.Drawing.Printing.PrintDocument();
            return p.DefaultPageSettings.PrinterSettings.PrinterName;
        }

        /// <summary>
        ///        
        /// </summary>
        /// <returns></returns> 
        public static List<string> GetComList()
        {
            List<string> ComList = new List<string>();
            Microsoft.VisualBasic.Devices.Computer pc = new Microsoft.VisualBasic.Devices.Computer();
            foreach (string s in pc.Ports.SerialPortNames)
            {
                ComList.Add(s);
            }
            return ComList;
        }