公司新聞

.NET 10 性能改進:Iron Software產品如何在最新的Framework中表現卓越

簡介

2025年11月11日發佈的Visual Studio 2026標誌著現代軟體開發的一個重要里程碑,引入了Microsoft所稱的首個"AI原生智慧開發環境"。Visual Studio 2026帶來了提升的效能改進、符合Fluent UI設計系統的全新介面,以及對.NET 10和C# 14的全面支援。對於使用Iron Software的.NET程式庫套件(包括IronPDF、IronOCR、IronBarcode和IronXL)進行開發的開發者而言,此最新版本提供了一個令人興奮的機會,可以利用最先進的開發工具以及強大的文件處理能力。

根據Cosmin Vladutu在Medium上的一篇文章,開發者對Visual Studio 2026的性能提升印象特別深刻,指出"建置速度比2022版快,而且記憶體大約為800–900 MB,與2022年的1200–1300 MB相比更小。"這種改進的性能為處理複雜操作的文件處理程式庫創造了理想的環境。

在本綜合指南中,我們將探討Iron Software完整的產品陣容如何與Visual Studio 2026無縫整合,並透過實際程式碼範例展示這強大組合對於. NET開發者在各種程式語言和框架上的優勢。

Visual Studio 2026:.NET開發者的關鍵功能

Visual Studio 2026

與Fluent UI設計系統的增強IDE體驗

Visual Studio 2026引入了一個完全重新設計的使用者體驗,介面更新與微軟的Fluent UI設計系統相契合。 新功能包括增強的編輯器控制、改進的視覺清晰度,以及對整體IDE主題的更多控制。 開發者現在可以選擇11種新增的色調主題,讓程式碼環境的高度自訂更符合個人偏好,並在長時間的開發會話中減少眼睛疲勞。

現代設定體驗取代了傳統的工具 > 選項對話框,提供了一個精簡且使用者友好的介面。 重新設計的使用者體驗讓.NET開發者更容易快速設定他們的開發環境,無論他們正在開發網頁應用程式、命令列介面工具,或是企業版專案。

Elanchezhiyan P在Medium上的文章所述,這款IDE具有"流暢的UI重新設計,佈局和圖標更加乾淨",使得開發體驗更加直觀和視覺上更具吸引力。

GitHub Copilot整合與AI驅動開發

GitHub Copilot 聊天

在Visual Studio 2026中最重要的進展之一是全IDE的深度copilot整合。profiler copilot代理可以分析CPU使用率、記憶體配置和運行時行為,提供更好的copilot反應和copilot洞察,以幫助開發者優化他們的程式碼。 副駕駛協助延伸到開發的各個方面,包括測試瀏覽器,開發人員可以利用AI自動生成和修復單元測試。

新的內容選單提供快速存取Copilot操作,而自適應貼上功能則會自動調整貼上的程式碼以適應您的專案上下文。 這些功能代表了一個向AI驅動開發的根本轉變,其中智能建議幫助開發者更快速地編碼而不犧牲程式碼品質。

性能提升和構建工具

Visual Studio 2026在各方面提供了顯著提升的性能。 現在,包含數百個現有專案的解決方案在 Visual Studio 2022 中載入速度快了40%。使用 F5 時,除錯器顯示啟動時間最高提升了30%,並且由於 IDE 和 .NET 10 運行時的優化,完整重建的感覺更接近於增量構建。

建置工具已經與IDE本身解耦,這意味著開發者可以在不影響其.NET或C++編譯器的情況下,透過自動的每月更新來更新Visual Studio。 這種分離確保了持續整合工作流程的穩定性,同時開發者能夠從IDE的最新功能和錯誤修復中受益。

程式碼覆蓋率和測試增強

在 Visual Studio 2026 中的一個重大突破是首次在 Visual Studio 社區版和專業版中提供程式碼覆蓋功能。此前,這一功能僅限於企業版,現在開發者可以分析程式碼覆蓋結果窗口,以了解哪些部分的程式碼被單元測試覆蓋。 測試工具的民主化使更多開發者在部署之前能確保其應用程式經過充分測試。

選擇分析程式碼覆蓋率選項允許開發者直接從測試選單中為選定的測試運行程式碼覆蓋率,並在程式碼覆蓋率窗口中顯示結果,顯示每個程式集、類和方法的百分比。 Visual Studio在程式碼編輯器中直接突出顯示已測試的程式碼行,使得識別測試覆蓋的空白區容易。

Iron Software產品:.NET 10相容性已確認

Iron Software首頁

在深入了解實作細節之前,確認所有Iron Software產品完全支援.NET 10非常重要,該版本是Visual Studio 2026的主要框架版本。根據Iron Software的官方網站,IronPDF、IronOCR、IronBarcode、IronXL、IronWord、IronPPT、IronQR、IronZIP、IronPrint和IronWebScraper等所有產品都完全支援.NET 10、9、8、7、6、Framework、Core及Azure部署。

這種全面的相容性確保了開發者在使用Iron Software的文件處理程式庫時,能夠利用最新版本的Visual Studio 2026。 這些程式庫支持多種程式語言,包括C#、VB.NET和F#,使其對更廣泛的.NET開發社群更具可及性。

IronPDF:在Visual Studio 2026中的PDF生成和操作

IronPDF首頁

開始使用IronPDF

IronPDF 是一個功能全面的C# PDF程式庫,它允許開發人員在.NET專案中建立、編輯和提取PDF內容。 隨著Visual Studio 2026對.NET 10的支援和加強的除錯功能,使用IronPDF變得更加高效。

要在您的Visual Studio 2026專案中安裝IronPDF,請開啟NuGet Package Manager Console並運行:

Install-Package IronPdf

或使用 .NET CLI:

dotnet add package IronPdf

了解更多關於IronPDF安裝的資訊

HTML 轉換為 PDF

IronPDF 最強大的功能之一是將HTML 轉換為 PDF,這在 Visual Studio 2026 增強的編碼環境中運行得非常流暢。 這裡有一個實際的例子:

using IronPdf;

// Create a new PDF from HTML string
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Hello from Visual Studio 2026!</h1><p>Generated with IronPDF</p>");

// Save the PDF
pdf.SaveAs("output.pdf");
using IronPdf;

// Create a new PDF from HTML string
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Hello from Visual Studio 2026!</h1><p>Generated with IronPDF</p>");

// Save the PDF
pdf.SaveAs("output.pdf");
Imports IronPdf

' Create a new PDF from HTML string
Dim renderer As New ChromePdfRenderer()
Dim pdf = renderer.RenderHtmlAsPdf("<h1>Hello from Visual Studio 2026!</h1><p>Generated with IronPDF</p>")

' Save the PDF
pdf.SaveAs("output.pdf")
$vbLabelText   $csharpLabel

生成的PDF

簡單的HTML到PDF輸出

借助Visual Studio 2026的內嵌返回值特性和改進的性能除錯功能,開發者可以即時看到RenderHtmlAsPdf方法的返回結果,而無需一步步地執行程式碼。 副駕駛見解還可以為優化PDF生成操作提供建議。

探索HTML到PDF轉換以及IronPDF可以渲染為PDF文件的不同形式,請參閱我們的廣泛文件操作指南

使用現有的PDF文件

IronPDF讓您可以輕鬆操作現有PDF文件。 Visual Studio 2026的增強編輯器控制使編寫此程式碼更直觀:

using IronPdf;

// Open an existing PDF
var pdf = PdfDocument.FromFile("existing.pdf");

// Add watermark
pdf.ApplyWatermark("<h2 style='color:red'>CONFIDENTIAL</h2>", 30, VerticalAlignment.Middle, HorizontalAlignment.Center);

// Extract text
string text = pdf.ExtractAllText();
Console.WriteLine(text);

// Save modified PDF
pdf.SaveAs("modified.pdf");
using IronPdf;

// Open an existing PDF
var pdf = PdfDocument.FromFile("existing.pdf");

// Add watermark
pdf.ApplyWatermark("<h2 style='color:red'>CONFIDENTIAL</h2>", 30, VerticalAlignment.Middle, HorizontalAlignment.Center);

// Extract text
string text = pdf.ExtractAllText();
Console.WriteLine(text);

// Save modified PDF
pdf.SaveAs("modified.pdf");
Imports IronPdf

' Open an existing PDF
Dim pdf = PdfDocument.FromFile("existing.pdf")

' Add watermark
pdf.ApplyWatermark("<h2 style='color:red'>CONFIDENTIAL</h2>", 30, VerticalAlignment.Middle, HorizontalAlignment.Center)

' Extract text
Dim text As String = pdf.ExtractAllText()
Console.WriteLine(text)

' Save modified PDF
pdf.SaveAs("modified.pdf")
$vbLabelText   $csharpLabel

使用Visual Studio Community 2026 修改的PDF

PDF已修改並加入浮水印

在Visual Studio 2026中新推出的剖析器體驗,讓您在處理大型PDF文件時可以輕鬆識別效能瓶頸。 開發者可以使用benchmarkdotnet專案模板來衡量和優化PDF操作。

PDF表單和數位簽署

IronPDF支援處理PDF表單數位簽名,這對於需要文件認證的Enterprise版應用程式至關重要:

using IronPdf;
using IronPdf.Signing;

// Open a PDF with form fields
var pdf = PdfDocument.FromFile("form.pdf");

// Fill form fields
pdf.Form.Fields["Name"].Value = "John Developer";
pdf.Form.Fields["Email"].Value = "john@example.com";

// Sign the PDF (using CSP-based certificates)
var signature = new PdfSignature("certificate.pfx", "password");
pdf.Sign(signature);

// Save the signed PDF
pdf.SaveAs("signed.pdf");
using IronPdf;
using IronPdf.Signing;

// Open a PDF with form fields
var pdf = PdfDocument.FromFile("form.pdf");

// Fill form fields
pdf.Form.Fields["Name"].Value = "John Developer";
pdf.Form.Fields["Email"].Value = "john@example.com";

// Sign the PDF (using CSP-based certificates)
var signature = new PdfSignature("certificate.pfx", "password");
pdf.Sign(signature);

// Save the signed PDF
pdf.SaveAs("signed.pdf");
Imports IronPdf
Imports IronPdf.Signing

' Open a PDF with form fields
Dim pdf = PdfDocument.FromFile("form.pdf")

' Fill form fields
pdf.Form.Fields("Name").Value = "John Developer"
pdf.Form.Fields("Email").Value = "john@example.com"

' Sign the PDF (using CSP-based certificates)
Dim signature = New PdfSignature("certificate.pfx", "password")
pdf.Sign(signature)

' Save the signed PDF
pdf.SaveAs("signed.pdf")
$vbLabelText   $csharpLabel

Visual Studio 2026中的程式碼覆蓋功能幫助確保表單填寫和簽名邏輯在不同情況下得到正確測試。

IronOCR:在Visual Studio 2026中的光學字元識別

IronOCR首頁

設定IronOCR

IronOCR 使開發者能夠在.NET應用程式中執行OCR操作,支持超過125種語言。 在 Visual Studio 2026 中安裝 IronOCR 很簡單:

Install-Package IronOcr

基本OCR操作

借助 Visual Studio 2026 的複雜偵錯工具和更好的 copilot 回應,使用OCR 變得更易管理:

using IronOcr;

// Initialize OCR engine
var ocr = new IronTesseract();

// Perform OCR on an image
using (var input = new OcrInput())
{
    input.AddImage("document.png");

    // Process the image
    var result = ocr.Read(input);

    // Extract text
    string text = result.Text;
    Console.WriteLine(text);

    // Get confidence level
    double confidence = result.Confidence;
    Console.WriteLine($"Confidence: {confidence}%");
}
using IronOcr;

// Initialize OCR engine
var ocr = new IronTesseract();

// Perform OCR on an image
using (var input = new OcrInput())
{
    input.AddImage("document.png");

    // Process the image
    var result = ocr.Read(input);

    // Extract text
    string text = result.Text;
    Console.WriteLine(text);

    // Get confidence level
    double confidence = result.Confidence;
    Console.WriteLine($"Confidence: {confidence}%");
}
Imports IronOcr

' Initialize OCR engine
Dim ocr As New IronTesseract()

' Perform OCR on an image
Using input As New OcrInput()
    input.AddImage("document.png")

    ' Process the image
    Dim result = ocr.Read(input)

    ' Extract text
    Dim text As String = result.Text
    Console.WriteLine(text)

    ' Get confidence level
    Dim confidence As Double = result.Confidence
    Console.WriteLine($"Confidence: {confidence}%")
End Using
$vbLabelText   $csharpLabel

控制台輸出

在Visual Studio 2026中的OCR範例輸出

Visual Studio 2026中的語法高亮功能使OCR程式碼更加易讀,而測試瀏覽器的整合則允許開發者為OCR準確性編寫全面的單元測試。

多語言OCR支援

IronOCR對多種語言的支援在Visual Studio 2026增強的語言支援中完美運作:

using IronOcr;

// Initialize with specific language
var ocr = new IronTesseract();
ocr.Language = OcrLanguage.Spanish;

// Add additional languages
ocr.AddSecondaryLanguage(OcrLanguage.French);

using (var input = new OcrInput())
{
    input.AddImage("multilingual-document.png");
    var result = ocr.Read(input);

    // Process multilingual text
    foreach (var page in result.Pages)
    {
        Console.WriteLine($"Page {page.PageNumber}: {page.Text}");
    }
}
using IronOcr;

// Initialize with specific language
var ocr = new IronTesseract();
ocr.Language = OcrLanguage.Spanish;

// Add additional languages
ocr.AddSecondaryLanguage(OcrLanguage.French);

using (var input = new OcrInput())
{
    input.AddImage("multilingual-document.png");
    var result = ocr.Read(input);

    // Process multilingual text
    foreach (var page in result.Pages)
    {
        Console.WriteLine($"Page {page.PageNumber}: {page.Text}");
    }
}
Imports IronOcr

' Initialize with specific language
Dim ocr As New IronTesseract()
ocr.Language = OcrLanguage.Spanish

' Add additional languages
ocr.AddSecondaryLanguage(OcrLanguage.French)

Using input As New OcrInput()
    input.AddImage("multilingual-document.png")
    Dim result = ocr.Read(input)

    ' Process multilingual text
    For Each page In result.Pages
        Console.WriteLine($"Page {page.PageNumber}: {page.Text}")
    Next
End Using
$vbLabelText   $csharpLabel

圖片增強的OCR

IronOCR包括圖像增強功能,以提高對低品質掃描的OCR準確性:

using IronOcr;

var ocr = new IronTesseract();

using (var input = new OcrInput())
{
    // Add image with enhancement
    input.AddImage("poor-quality-scan.jpg");

    // Apply filters
    input.Deskew();
    input.DeNoise();
    input.Dilate();

    // Perform OCR
    var result = ocr.Read(input);
    Console.WriteLine(result.Text);
}
using IronOcr;

var ocr = new IronTesseract();

using (var input = new OcrInput())
{
    // Add image with enhancement
    input.AddImage("poor-quality-scan.jpg");

    // Apply filters
    input.Deskew();
    input.DeNoise();
    input.Dilate();

    // Perform OCR
    var result = ocr.Read(input);
    Console.WriteLine(result.Text);
}
Imports IronOcr

Dim ocr As New IronTesseract()

Using input As New OcrInput()
    ' Add image with enhancement
    input.AddImage("poor-quality-scan.jpg")

    ' Apply filters
    input.Deskew()
    input.DeNoise()
    input.Dilate()

    ' Perform OCR
    Dim result = ocr.Read(input)
    Console.WriteLine(result.Text)
End Using
$vbLabelText   $csharpLabel

Visual Studio 2026 的內聯 if 語句除錯功能幫助開發者準確了解應用了哪些增強篩選器及其對 OCR 結果的影響。

IronBarcode:條碼和QR Code處理

IronBarcode首頁

安裝IronBarcode

IronBarcode 提供完整的條碼讀取和寫入功能,適用於.NET應用程式:

Install-Package IronBarcode

開始使用IronBarcode

從圖片讀取條碼

Visual Studio 2026的檔案IO工具讓處理包含條碼的影像檔變得簡單。

using IronBarCode;

// Read barcode from image file
var results = BarcodeReader.Read("barcode-image.png");

foreach (var result in results)
{
    Console.WriteLine($"Barcode Type: {result.BarcodeType}");
    Console.WriteLine($"Value: {result.Value}");
}
using IronBarCode;

// Read barcode from image file
var results = BarcodeReader.Read("barcode-image.png");

foreach (var result in results)
{
    Console.WriteLine($"Barcode Type: {result.BarcodeType}");
    Console.WriteLine($"Value: {result.Value}");
}
Imports IronBarCode

' Read barcode from image file
Dim results = BarcodeReader.Read("barcode-image.png")

For Each result In results
    Console.WriteLine($"Barcode Type: {result.BarcodeType}")
    Console.WriteLine($"Value: {result.Value}")
Next
$vbLabelText   $csharpLabel

IronBarcode 主控台輸出

使用IronBarcode讀取我們的條碼的輸出資訊

在Visual Studio 2026中改進的效能確保條碼讀取操作執行快速,即便在批次操作中處理多張圖片時也是如此。

生成條碼

使用IronBarcode建立條碼非常簡單,而且在Visual Studio 2026中更新的介面使開發體驗更加愉快:

using IronBarCode;
using IronSoftware.Drawing;

// Generate a QR code
var qrCode = BarcodeWriter.CreateBarcode("https://ironsoftware.com", BarcodeEncoding.QRCode);

// Customize appearance
qrCode.SetMargins(10);
qrCode.AddBarcodeValueTextBelowBarcode();
qrCode.ChangeBarCodeColor(Color.Blue);

// Save as image
qrCode.SaveAsImage("qr-code.png");

// Or save as PDF
qrCode.SaveAsPdf("qr-code.pdf");
using IronBarCode;
using IronSoftware.Drawing;

// Generate a QR code
var qrCode = BarcodeWriter.CreateBarcode("https://ironsoftware.com", BarcodeEncoding.QRCode);

// Customize appearance
qrCode.SetMargins(10);
qrCode.AddBarcodeValueTextBelowBarcode();
qrCode.ChangeBarCodeColor(Color.Blue);

// Save as image
qrCode.SaveAsImage("qr-code.png");

// Or save as PDF
qrCode.SaveAsPdf("qr-code.pdf");
Imports IronBarCode
Imports IronSoftware.Drawing

' Generate a QR code
Dim qrCode = BarcodeWriter.CreateBarcode("https://ironsoftware.com", BarcodeEncoding.QRCode)

' Customize appearance
qrCode.SetMargins(10)
qrCode.AddBarcodeValueTextBelowBarcode()
qrCode.ChangeBarCodeColor(Color.Blue)

' Save as image
qrCode.SaveAsImage("qr-code.png")

' Or save as PDF
qrCode.SaveAsPdf("qr-code.pdf")
$vbLabelText   $csharpLabel

已建立QR Code

使用IronBarcode建立的QR Code

使用機器學習檢測進行高級條碼讀取

IronBarcode支援基於機器學習的檢測以提高準確性:

using IronBarCode;

// Configure barcode reader with ML detection
var options = new BarcodeReaderOptions
{
    ExpectMultipleBarcodes = true,
    ExpectBarcodeTypes = BarcodeEncoding.AllOneDimensional,
    CropArea = new System.Drawing.Rectangle(0, 0, 500, 500),
    UseCode39ExtendedMode = true
};

// Read barcodes with options
var results = BarcodeReader.Read("multi-barcode-image.png", options);

foreach (var barcode in results)
{
    Console.WriteLine($"Found: {barcode.BarcodeType} = {barcode.Value}");
}
using IronBarCode;

// Configure barcode reader with ML detection
var options = new BarcodeReaderOptions
{
    ExpectMultipleBarcodes = true,
    ExpectBarcodeTypes = BarcodeEncoding.AllOneDimensional,
    CropArea = new System.Drawing.Rectangle(0, 0, 500, 500),
    UseCode39ExtendedMode = true
};

// Read barcodes with options
var results = BarcodeReader.Read("multi-barcode-image.png", options);

foreach (var barcode in results)
{
    Console.WriteLine($"Found: {barcode.BarcodeType} = {barcode.Value}");
}
Imports IronBarCode
Imports System.Drawing

' Configure barcode reader with ML detection
Dim options As New BarcodeReaderOptions With {
    .ExpectMultipleBarcodes = True,
    .ExpectBarcodeTypes = BarcodeEncoding.AllOneDimensional,
    .CropArea = New Rectangle(0, 0, 500, 500),
    .UseCode39ExtendedMode = True
}

' Read barcodes with options
Dim results = BarcodeReader.Read("multi-barcode-image.png", options)

For Each barcode In results
    Console.WriteLine($"Found: {barcode.BarcodeType} = {barcode.Value}")
Next
$vbLabelText   $csharpLabel

Visual Studio 2026中的網路配置工具幫助開發者在處理大型條碼圖像批次時優化記憶體使用。

IronXL:無需 Office Interop 的 Excel 文件處理

IronXL首頁

開始使用IronXL

IronXL 允許開發者讀取、生成和編輯Excel文件,而不需要Microsoft Office或Excel Interop。

開始使用IronXL

建立Excel工作簿

利用 Visual Studio 2026 的專案模板和改進的程式碼編輯器,建立 Excel 文件 變得輕而易舉:

using IronXL;

// Create a new Excel workbook
WorkBook workbook = WorkBook.Create(ExcelFileFormat.XLSX);
WorkSheet sheet = workbook.DefaultWorkSheet;

// Add data
sheet["A1"].Value = "Product";
sheet["B1"].Value = "Quantity";
sheet["C1"].Value = "Price";

// Add rows of data
sheet["A2"].Value = "IronPDF License";
sheet["B2"].Value = 1;
sheet["C2"].Value = 599;

sheet["A3"].Value = "IronOCR License";
sheet["B3"].Value = 1;
sheet["C3"].Value = 499;

// Add formula
sheet["C4"].Formula = "=SUM(C2:C3)";

// Save the workbook
workbook.SaveAs("products.xlsx");
using IronXL;

// Create a new Excel workbook
WorkBook workbook = WorkBook.Create(ExcelFileFormat.XLSX);
WorkSheet sheet = workbook.DefaultWorkSheet;

// Add data
sheet["A1"].Value = "Product";
sheet["B1"].Value = "Quantity";
sheet["C1"].Value = "Price";

// Add rows of data
sheet["A2"].Value = "IronPDF License";
sheet["B2"].Value = 1;
sheet["C2"].Value = 599;

sheet["A3"].Value = "IronOCR License";
sheet["B3"].Value = 1;
sheet["C3"].Value = 499;

// Add formula
sheet["C4"].Formula = "=SUM(C2:C3)";

// Save the workbook
workbook.SaveAs("products.xlsx");
Imports IronXL

' Create a new Excel workbook
Dim workbook As WorkBook = WorkBook.Create(ExcelFileFormat.XLSX)
Dim sheet As WorkSheet = workbook.DefaultWorkSheet

' Add data
sheet("A1").Value = "Product"
sheet("B1").Value = "Quantity"
sheet("C1").Value = "Price"

' Add rows of data
sheet("A2").Value = "IronPDF License"
sheet("B2").Value = 1
sheet("C2").Value = 599

sheet("A3").Value = "IronOCR License"
sheet("B3").Value = 1
sheet("C3").Value = 499

' Add formula
sheet("C4").Formula = "=SUM(C2:C3)"

' Save the workbook
workbook.SaveAs("products.xlsx")
$vbLabelText   $csharpLabel

建立的Excel文件輸出

範例Excel文件輸出

Visual Studio 2026增強的語法高亮顯示提供的視覺清晰度,使Excel操作程式碼更易於閱讀和維護。

讀取現有的Excel文件

IronXL可以從現有的Excel檔案中高效地讀取資料

using IronXL;

// Load existing Excel file
WorkBook workbook = WorkBook.Load("sales-data.xlsx");
WorkSheet sheet = workbook.GetWorkSheet("Sales");

// Read cells
foreach (var row in sheet.Rows)
{
    foreach (var cell in row)
    {
        Console.Write($"{cell.Value}\t");
    }
    Console.WriteLine();
}

// Access specific cell
var totalSales = sheet["D10"].DoubleValue;
Console.WriteLine($"Total Sales: ${totalSales:F2}");
using IronXL;

// Load existing Excel file
WorkBook workbook = WorkBook.Load("sales-data.xlsx");
WorkSheet sheet = workbook.GetWorkSheet("Sales");

// Read cells
foreach (var row in sheet.Rows)
{
    foreach (var cell in row)
    {
        Console.Write($"{cell.Value}\t");
    }
    Console.WriteLine();
}

// Access specific cell
var totalSales = sheet["D10"].DoubleValue;
Console.WriteLine($"Total Sales: ${totalSales:F2}");
Imports IronXL

' Load existing Excel file
Dim workbook As WorkBook = WorkBook.Load("sales-data.xlsx")
Dim sheet As WorkSheet = workbook.GetWorkSheet("Sales")

' Read cells
For Each row In sheet.Rows
    For Each cell In row
        Console.Write($"{cell.Value}" & vbTab)
    Next
    Console.WriteLine()
Next

' Access specific cell
Dim totalSales = sheet("D10").DoubleValue
Console.WriteLine($"Total Sales: ${totalSales:F2}")
$vbLabelText   $csharpLabel

控制台輸出

從現有的Excel檔案中提取的銷售資料

Visual Studio 2026中的零長度陣列分配優化有助於確保在讀取大型Excel文件時的記憶體使用效率。

處理 Excel 範圍和格式化

IronXL支援進階Excel操作,包括範圍樣式公式

using IronXL;

WorkBook workbook = WorkBook.Load(@"C:\Users\kyess\Desktop\Desktop\Code-Projects\Assets\financial_report.xlsx");
WorkSheet sheet = workbook.DefaultWorkSheet;

// Select a range
var range = sheet["A1:D1"];

range.Style.Font.Bold = true;
range.Style.Font.Height = 12; 
range.Style.SetBackgroundColor("#0066CC");
range.Style.Font.SetColor("#FFFFFF");

for (int i = 0; i <= 3; i++)
{
    sheet.AutoSizeColumn(i);
}

// Save changes
workbook.SaveAs("formatted-report.xlsx");
using IronXL;

WorkBook workbook = WorkBook.Load(@"C:\Users\kyess\Desktop\Desktop\Code-Projects\Assets\financial_report.xlsx");
WorkSheet sheet = workbook.DefaultWorkSheet;

// Select a range
var range = sheet["A1:D1"];

range.Style.Font.Bold = true;
range.Style.Font.Height = 12; 
range.Style.SetBackgroundColor("#0066CC");
range.Style.Font.SetColor("#FFFFFF");

for (int i = 0; i <= 3; i++)
{
    sheet.AutoSizeColumn(i);
}

// Save changes
workbook.SaveAs("formatted-report.xlsx");
Imports IronXL

Dim workbook As WorkBook = WorkBook.Load("C:\Users\kyess\Desktop\Desktop\Code-Projects\Assets\financial_report.xlsx")
Dim sheet As WorkSheet = workbook.DefaultWorkSheet

' Select a range
Dim range = sheet("A1:D1")

range.Style.Font.Bold = True
range.Style.Font.Height = 12
range.Style.SetBackgroundColor("#0066CC")
range.Style.Font.SetColor("#FFFFFF")

For i As Integer = 0 To 3
    sheet.AutoSizeColumn(i)
Next

' Save changes
workbook.SaveAs("formatted-report.xlsx")
$vbLabelText   $csharpLabel

具有樣式的範例輸出

格式化的Excel工作表

與Visual Studio 2026功能的整合

利用GitHub Copilot與Iron Software程式庫

使用Copilot生成可運作的程式碼

在 Visual Studio 2026 中,深度整合 GitHub Copilot 可以在使用 Iron Software 產品時提供智能的程式碼建議。 Copilot 可以:

  • 從自然語言描述生成完整的IronPDF渲染程式碼

  • 根據影像品質建議最佳OCR設定

  • 推薦條碼型別和編碼參數

建立 Excel 公式和資料操作邏輯

簡單描述您想要實現的目標,然後Copilot將使用Iron Software程式庫生成相關程式碼。 Markdown編輯器支援也讓您能輕鬆地透過範例來記錄您的程式碼。

除錯Iron Software應用程式

Visual Studio 2026的增強除錯功能在處理文件時顯著提升了開發體驗。

using IronPdf;
using System.Diagnostics;

public class PdfProcessor
{
    public void ProcessDocument(string htmlContent, string outputPath)
    {
        // Visual Studio 2026 shows inline values here
        var renderer = new ChromePdfRenderer();

        // Inline if-statement debugging shows evaluation results
        if (string.IsNullOrEmpty(htmlContent))
        {
            throw new ArgumentException("HTML content cannot be empty");
        }

        // Inline post-return values show the PDF object immediately
        var pdf = renderer.RenderHtmlAsPdf(htmlContent);

        // Copilot can analyze unexpected results
        var pageCount = pdf.PageCount;
        Debug.WriteLine($"Generated PDF with {pageCount} pages");

        pdf.SaveAs(outputPath);
    }
}
using IronPdf;
using System.Diagnostics;

public class PdfProcessor
{
    public void ProcessDocument(string htmlContent, string outputPath)
    {
        // Visual Studio 2026 shows inline values here
        var renderer = new ChromePdfRenderer();

        // Inline if-statement debugging shows evaluation results
        if (string.IsNullOrEmpty(htmlContent))
        {
            throw new ArgumentException("HTML content cannot be empty");
        }

        // Inline post-return values show the PDF object immediately
        var pdf = renderer.RenderHtmlAsPdf(htmlContent);

        // Copilot can analyze unexpected results
        var pageCount = pdf.PageCount;
        Debug.WriteLine($"Generated PDF with {pageCount} pages");

        pdf.SaveAs(outputPath);
    }
}
Imports IronPdf
Imports System.Diagnostics

Public Class PdfProcessor
    Public Sub ProcessDocument(htmlContent As String, outputPath As String)
        ' Visual Studio 2026 shows inline values here
        Dim renderer = New ChromePdfRenderer()

        ' Inline if-statement debugging shows evaluation results
        If String.IsNullOrEmpty(htmlContent) Then
            Throw New ArgumentException("HTML content cannot be empty")
        End If

        ' Inline post-return values show the PDF object immediately
        Dim pdf = renderer.RenderHtmlAsPdf(htmlContent)

        ' Copilot can analyze unexpected results
        Dim pageCount = pdf.PageCount
        Debug.WriteLine($"Generated PDF with {pageCount} pages")

        pdf.SaveAs(outputPath)
    End Sub
End Class
$vbLabelText   $csharpLabel

結合了Copilot分析的內嵌除錯功能,使理解文件處理工作流程及快速識別問題變得簡單。

使用Iron Software進行效能分析

Visual Studio 2026中的探查器助手代理可以在使用Iron Software程式庫時分析效能:

using IronPdf;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;

[MemoryDiagnoser]
public class PdfBenchmarks
{
    private const string SampleHtml = "<html><body><h1>Test Document</h1></body></html>";

    [Benchmark]
    public void RenderSimplePdf()
    {
        var renderer = new ChromePdfRenderer();
        var pdf = renderer.RenderHtmlAsPdf(SampleHtml);
    }

    [Benchmark]
    public void RenderComplexPdf()
    {
        var renderer = new ChromePdfRenderer();
        var complexHtml = GenerateComplexHtml();
        var pdf = renderer.RenderHtmlAsPdf(complexHtml);
    }

    private string GenerateComplexHtml()
    {
        // Generate HTML with tables, images, etc.
        return "<html><body><table>...</table></body></html>";
    }
}

partial class Program
{
    static void Main(string[] args)
    {
        var summary = BenchmarkRunner.Run<PdfBenchmarks>();
    }
}
using IronPdf;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;

[MemoryDiagnoser]
public class PdfBenchmarks
{
    private const string SampleHtml = "<html><body><h1>Test Document</h1></body></html>";

    [Benchmark]
    public void RenderSimplePdf()
    {
        var renderer = new ChromePdfRenderer();
        var pdf = renderer.RenderHtmlAsPdf(SampleHtml);
    }

    [Benchmark]
    public void RenderComplexPdf()
    {
        var renderer = new ChromePdfRenderer();
        var complexHtml = GenerateComplexHtml();
        var pdf = renderer.RenderHtmlAsPdf(complexHtml);
    }

    private string GenerateComplexHtml()
    {
        // Generate HTML with tables, images, etc.
        return "<html><body><table>...</table></body></html>";
    }
}

partial class Program
{
    static void Main(string[] args)
    {
        var summary = BenchmarkRunner.Run<PdfBenchmarks>();
    }
}
Imports IronPdf
Imports BenchmarkDotNet.Attributes
Imports BenchmarkDotNet.Running

<MemoryDiagnoser>
Public Class PdfBenchmarks
    Private Const SampleHtml As String = "<html><body><h1>Test Document</h1></body></html>"

    <Benchmark>
    Public Sub RenderSimplePdf()
        Dim renderer = New ChromePdfRenderer()
        Dim pdf = renderer.RenderHtmlAsPdf(SampleHtml)
    End Sub

    <Benchmark>
    Public Sub RenderComplexPdf()
        Dim renderer = New ChromePdfRenderer()
        Dim complexHtml = GenerateComplexHtml()
        Dim pdf = renderer.RenderHtmlAsPdf(complexHtml)
    End Sub

    Private Function GenerateComplexHtml() As String
        ' Generate HTML with tables, images, etc.
        Return "<html><body><table>...</table></body></html>"
    End Function
End Class

Partial Class Program
    Shared Sub Main(ByVal args As String())
        Dim summary = BenchmarkRunner.Run(Of PdfBenchmarks)()
    End Sub
End Class
$vbLabelText   $csharpLabel

using Visual Studio 2026 中的 benchmarkdotnet 專案範本來建立效能測試,並利用效能分析器來識別優化機會。

雲端服務整合

Iron Software產品可與從Visual Studio 2026部署的雲服務無縫協作:

using Microsoft.Azure.Functions;
using IronPdf;
using IronOcr;

public class DocumentProcessor
{
    [FunctionName("ConvertHtmlToPdf")]
    public async Task<IActionResult> ConvertToPdf(
        [HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequest req)
    {
        string html = await new StreamReader(req.Body).ReadToEndAsync();

        // Configure IronPDF for Azure
        License.LicenseKey = Environment.GetEnvironmentVariable("IRONPDF_LICENSE");

        var renderer = new ChromePdfRenderer();
        var pdf = renderer.RenderHtmlAsPdf(html);

        return new FileContentResult(pdf.BinaryData, "application/pdf")
        {
            FileDownloadName = "document.pdf"
        };
    }

    [FunctionName("ExtractTextFromImage")]
    public async Task<IActionResult> ExtractText(
        [HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequest req)
    {
        var imageBytes = await ReadImageBytes(req);

        License.LicenseKey = Environment.GetEnvironmentVariable("IRONOCR_LICENSE");

        var ocr = new IronTesseract();
        using (var input = new OcrInput())
        {
            input.AddImage(imageBytes);
            var result = ocr.Read(input);

            return new OkObjectResult(new { text = result.Text });
        }
    }
}
using Microsoft.Azure.Functions;
using IronPdf;
using IronOcr;

public class DocumentProcessor
{
    [FunctionName("ConvertHtmlToPdf")]
    public async Task<IActionResult> ConvertToPdf(
        [HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequest req)
    {
        string html = await new StreamReader(req.Body).ReadToEndAsync();

        // Configure IronPDF for Azure
        License.LicenseKey = Environment.GetEnvironmentVariable("IRONPDF_LICENSE");

        var renderer = new ChromePdfRenderer();
        var pdf = renderer.RenderHtmlAsPdf(html);

        return new FileContentResult(pdf.BinaryData, "application/pdf")
        {
            FileDownloadName = "document.pdf"
        };
    }

    [FunctionName("ExtractTextFromImage")]
    public async Task<IActionResult> ExtractText(
        [HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequest req)
    {
        var imageBytes = await ReadImageBytes(req);

        License.LicenseKey = Environment.GetEnvironmentVariable("IRONOCR_LICENSE");

        var ocr = new IronTesseract();
        using (var input = new OcrInput())
        {
            input.AddImage(imageBytes);
            var result = ocr.Read(input);

            return new OkObjectResult(new { text = result.Text });
        }
    }
}
Imports Microsoft.Azure.Functions
Imports IronPdf
Imports IronOcr
Imports System.IO
Imports Microsoft.AspNetCore.Mvc
Imports Microsoft.AspNetCore.Http
Imports System.Threading.Tasks

Public Class DocumentProcessor

    <FunctionName("ConvertHtmlToPdf")>
    Public Async Function ConvertToPdf(
        <HttpTrigger(AuthorizationLevel.Function, "post")> req As HttpRequest) As Task(Of IActionResult)

        Dim html As String = Await New StreamReader(req.Body).ReadToEndAsync()

        ' Configure IronPDF for Azure
        License.LicenseKey = Environment.GetEnvironmentVariable("IRONPDF_LICENSE")

        Dim renderer As New ChromePdfRenderer()
        Dim pdf = renderer.RenderHtmlAsPdf(html)

        Return New FileContentResult(pdf.BinaryData, "application/pdf") With {
            .FileDownloadName = "document.pdf"
        }
    End Function

    <FunctionName("ExtractTextFromImage")>
    Public Async Function ExtractText(
        <HttpTrigger(AuthorizationLevel.Function, "post")> req As HttpRequest) As Task(Of IActionResult)

        Dim imageBytes = Await ReadImageBytes(req)

        License.LicenseKey = Environment.GetEnvironmentVariable("IRONOCR_LICENSE")

        Dim ocr As New IronTesseract()
        Using input As New OcrInput()
            input.AddImage(imageBytes)
            Dim result = ocr.Read(input)

            Return New OkObjectResult(New With {.text = result.Text})
        End Using
    End Function

    Private Async Function ReadImageBytes(req As HttpRequest) As Task(Of Byte())
        Using memoryStream As New MemoryStream()
            Await req.Body.CopyToAsync(memoryStream)
            Return memoryStream.ToArray()
        End Using
    End Function

End Class
$vbLabelText   $csharpLabel

Visual Studio 2026對雲端服務的擴展支援使得將Iron Software驅動的應用程式部署到Azure變得簡單。

在Visual Studio 2026中測試Iron Software應用程式

單元測試與程式碼覆蓋率

Visual Studio 2026 的社群版和專業版中的程式碼覆蓋功能允許對 Iron Software 整合進行全面的測試:

using Microsoft.VisualStudio.TestTools.UnitTesting;
using IronPdf;
using System.IO;

[TestClass]
public class PdfGenerationTests
{
    [TestMethod]
    public void TestSimpleHtmlToPdf()
    {
        // Arrange
        var renderer = new ChromePdfRenderer();
        var html = "<h1>Test</h1>";

        // Act
        var pdf = renderer.RenderHtmlAsPdf(html);

        // Assert
        Assert.IsNotNull(pdf);
        Assert.IsTrue(pdf.PageCount > 0);
        Assert.IsTrue(pdf.BinaryData.Length > 0);
    }

    [TestMethod]
    public void TestPdfExtraction()
    {
        // Arrange
        var html = "<html><body><p>Sample text for extraction</p></body></html>";
        var renderer = new ChromePdfRenderer();
        var pdf = renderer.RenderHtmlAsPdf(html);

        // Act
        var extractedText = pdf.ExtractAllText();

        // Assert
        Assert.IsTrue(extractedText.Contains("Sample text"));
    }

    [TestMethod]
    [DataRow("document1.html")]
    [DataRow("document2.html")]
    [DataRow("document3.html")]
    public void TestBatchPdfGeneration(string filename)
    {
        // Arrange
        var html = File.ReadAllText(filename);
        var renderer = new ChromePdfRenderer();

        // Act
        var pdf = renderer.RenderHtmlAsPdf(html);

        // Assert
        Assert.IsNotNull(pdf);
        Assert.IsTrue(pdf.PageCount > 0);
    }
}
using Microsoft.VisualStudio.TestTools.UnitTesting;
using IronPdf;
using System.IO;

[TestClass]
public class PdfGenerationTests
{
    [TestMethod]
    public void TestSimpleHtmlToPdf()
    {
        // Arrange
        var renderer = new ChromePdfRenderer();
        var html = "<h1>Test</h1>";

        // Act
        var pdf = renderer.RenderHtmlAsPdf(html);

        // Assert
        Assert.IsNotNull(pdf);
        Assert.IsTrue(pdf.PageCount > 0);
        Assert.IsTrue(pdf.BinaryData.Length > 0);
    }

    [TestMethod]
    public void TestPdfExtraction()
    {
        // Arrange
        var html = "<html><body><p>Sample text for extraction</p></body></html>";
        var renderer = new ChromePdfRenderer();
        var pdf = renderer.RenderHtmlAsPdf(html);

        // Act
        var extractedText = pdf.ExtractAllText();

        // Assert
        Assert.IsTrue(extractedText.Contains("Sample text"));
    }

    [TestMethod]
    [DataRow("document1.html")]
    [DataRow("document2.html")]
    [DataRow("document3.html")]
    public void TestBatchPdfGeneration(string filename)
    {
        // Arrange
        var html = File.ReadAllText(filename);
        var renderer = new ChromePdfRenderer();

        // Act
        var pdf = renderer.RenderHtmlAsPdf(html);

        // Assert
        Assert.IsNotNull(pdf);
        Assert.IsTrue(pdf.PageCount > 0);
    }
}
Imports Microsoft.VisualStudio.TestTools.UnitTesting
Imports IronPdf
Imports System.IO

<TestClass>
Public Class PdfGenerationTests

    <TestMethod>
    Public Sub TestSimpleHtmlToPdf()
        ' Arrange
        Dim renderer As New ChromePdfRenderer()
        Dim html As String = "<h1>Test</h1>"

        ' Act
        Dim pdf = renderer.RenderHtmlAsPdf(html)

        ' Assert
        Assert.IsNotNull(pdf)
        Assert.IsTrue(pdf.PageCount > 0)
        Assert.IsTrue(pdf.BinaryData.Length > 0)
    End Sub

    <TestMethod>
    Public Sub TestPdfExtraction()
        ' Arrange
        Dim html As String = "<html><body><p>Sample text for extraction</p></body></html>"
        Dim renderer As New ChromePdfRenderer()
        Dim pdf = renderer.RenderHtmlAsPdf(html)

        ' Act
        Dim extractedText As String = pdf.ExtractAllText()

        ' Assert
        Assert.IsTrue(extractedText.Contains("Sample text"))
    End Sub

    <TestMethod>
    <DataRow("document1.html")>
    <DataRow("document2.html")>
    <DataRow("document3.html")>
    Public Sub TestBatchPdfGeneration(filename As String)
        ' Arrange
        Dim html As String = File.ReadAllText(filename)
        Dim renderer As New ChromePdfRenderer()

        ' Act
        Dim pdf = renderer.RenderHtmlAsPdf(html)

        ' Assert
        Assert.IsNotNull(pdf)
        Assert.IsTrue(pdf.PageCount > 0)
    End Sub

End Class
$vbLabelText   $csharpLabel

使用測試總管執行這些測試,並通過程式碼覆蓋率結果視窗分析結果,以確保您的文件處理邏輯測試覆蓋全面。

整合測試

對於涉及多個Iron Software產品的整合測試:

using Microsoft.VisualStudio.TestTools.UnitTesting;
using IronPdf;
using IronOcr;
using IronBarCode;

[TestClass]
public class DocumentWorkflowTests
{
    [TestMethod]
    public void TestCompleteDocumentWorkflow()
    {
        // Step 1: Generate PDF with barcode
        var renderer = new ChromePdfRenderer();
        var barcode = BarcodeWriter.CreateBarcode("DOC-12345", BarcodeEncoding.QRCode);

        var html = $@"
            <html>
            <body>
                <h1>Document #DOC-12345</h1>
                <img src='{barcode.ToDataUrl()}' />
                <p>This is a test document with a QR code.</p>
            </body>
            </html>";

        var pdf = renderer.RenderHtmlAsPdf(html);
        pdf.SaveAs("test-document.pdf");

        // Step 2: Convert PDF to image
        pdf.RasterizeToImageFiles("test-page-*.png");

        // Step 3: Read barcode from image
        var barcodeResults = BarcodeReader.Read("test-page-1.png");

        // Step 4: Verify barcode content
        Assert.IsTrue(barcodeResults.Any());
        Assert.AreEqual("DOC-12345", barcodeResults.First().Value);

        // Step 5: OCR the document
        var ocr = new IronTesseract();
        using (var input = new OcrInput())
        {
            input.AddImage("test-page-1.png");
            var ocrResult = ocr.Read(input);

            Assert.IsTrue(ocrResult.Text.Contains("Document"));
        }
    }
}
using Microsoft.VisualStudio.TestTools.UnitTesting;
using IronPdf;
using IronOcr;
using IronBarCode;

[TestClass]
public class DocumentWorkflowTests
{
    [TestMethod]
    public void TestCompleteDocumentWorkflow()
    {
        // Step 1: Generate PDF with barcode
        var renderer = new ChromePdfRenderer();
        var barcode = BarcodeWriter.CreateBarcode("DOC-12345", BarcodeEncoding.QRCode);

        var html = $@"
            <html>
            <body>
                <h1>Document #DOC-12345</h1>
                <img src='{barcode.ToDataUrl()}' />
                <p>This is a test document with a QR code.</p>
            </body>
            </html>";

        var pdf = renderer.RenderHtmlAsPdf(html);
        pdf.SaveAs("test-document.pdf");

        // Step 2: Convert PDF to image
        pdf.RasterizeToImageFiles("test-page-*.png");

        // Step 3: Read barcode from image
        var barcodeResults = BarcodeReader.Read("test-page-1.png");

        // Step 4: Verify barcode content
        Assert.IsTrue(barcodeResults.Any());
        Assert.AreEqual("DOC-12345", barcodeResults.First().Value);

        // Step 5: OCR the document
        var ocr = new IronTesseract();
        using (var input = new OcrInput())
        {
            input.AddImage("test-page-1.png");
            var ocrResult = ocr.Read(input);

            Assert.IsTrue(ocrResult.Text.Contains("Document"));
        }
    }
}
Imports Microsoft.VisualStudio.TestTools.UnitTesting
Imports IronPdf
Imports IronOcr
Imports IronBarCode

<TestClass>
Public Class DocumentWorkflowTests

    <TestMethod>
    Public Sub TestCompleteDocumentWorkflow()
        ' Step 1: Generate PDF with barcode
        Dim renderer As New ChromePdfRenderer()
        Dim barcode = BarcodeWriter.CreateBarcode("DOC-12345", BarcodeEncoding.QRCode)

        Dim html As String = $"
            <html>
            <body>
                <h1>Document #DOC-12345</h1>
                <img src='{barcode.ToDataUrl()}' />
                <p>This is a test document with a QR code.</p>
            </body>
            </html>"

        Dim pdf = renderer.RenderHtmlAsPdf(html)
        pdf.SaveAs("test-document.pdf")

        ' Step 2: Convert PDF to image
        pdf.RasterizeToImageFiles("test-page-*.png")

        ' Step 3: Read barcode from image
        Dim barcodeResults = BarcodeReader.Read("test-page-1.png")

        ' Step 4: Verify barcode content
        Assert.IsTrue(barcodeResults.Any())
        Assert.AreEqual("DOC-12345", barcodeResults.First().Value)

        ' Step 5: OCR the document
        Dim ocr As New IronTesseract()
        Using input As New OcrInput()
            input.AddImage("test-page-1.png")
            Dim ocrResult = ocr.Read(input)

            Assert.IsTrue(ocrResult.Text.Contains("Document"))
        End Using
    End Sub

End Class
$vbLabelText   $csharpLabel

Visual Studio 2026中的自訂參數功能允許您在執行整合測試時傳遞不同的測試配置。

在 Visual Studio 2026 中使用 Iron Software 的最佳實踐

專案範本和結構

在Visual Studio 2026中開始使用Iron Software產品的新專案時:

  1. 使用適當的.NET 10專案範本建立一個專案

在Visual Studio中建立專案

  1. 安裝所需的Iron Software NuGet套件

安裝Iron Software NuGet套件

  1. 在應用程式設定中配置授權金鑰

  2. 為Iron Software服務設置依賴注入

  3. 實施適當的錯誤處理和日誌記錄
using Microsoft.Extensions.DependencyInjection;
using IronPdf;
using IronOcr;

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        // Configure IronPDF
        services.AddSingleton<ChromePdfRenderer>();

        // Configure IronOCR
        services.AddSingleton<IronTesseract>();

        // Add other services
        services.AddLogging();
    }
}
using Microsoft.Extensions.DependencyInjection;
using IronPdf;
using IronOcr;

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        // Configure IronPDF
        services.AddSingleton<ChromePdfRenderer>();

        // Configure IronOCR
        services.AddSingleton<IronTesseract>();

        // Add other services
        services.AddLogging();
    }
}
Imports Microsoft.Extensions.DependencyInjection
Imports IronPdf
Imports IronOcr

Public Class Startup
    Public Sub ConfigureServices(services As IServiceCollection)
        ' Configure IronPDF
        services.AddSingleton(Of ChromePdfRenderer)()

        ' Configure IronOCR
        services.AddSingleton(Of IronTesseract)()

        ' Add other services
        services.AddLogging()
    End Sub
End Class
$vbLabelText   $csharpLabel

從搜尋中排除文件

排除文件

using Visual Studio 2026 的排除檔案功能來避免搜尋生成的PDF或大型文件檔案:

  1. 移至 工具 → 選項 → 環境 → 搜尋

  2. 新增模式,例如.pdf, .xlsx, 或 output/**/* 以排除這些檔案在搜尋結果中顯示

  3. 這改善了搜尋效能,並在尋找程式碼時降低了雜訊

持續整合工作流程

在部署Iron Software應用程式時,利用Visual Studio 2026改善的持續整合工作流程:

name: Build and Test

on: [push, pull_request]

jobs:
  build:
    runs-on: windows-latest

    steps:
    - uses: actions/checkout@v2

    - name: Setup .NET 10
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: '10.0.x'

    - name: Restore dependencies
      run: dotnet restore

    - name: Build
      run: dotnet build --configuration Release

    - name: Run unit tests
      run: dotnet test --configuration Release --logger trunit

    - name: Run code coverage
      run: dotnet test --collect:"XPlat Code Coverage"
name: Build and Test

on: [push, pull_request]

jobs:
  build:
    runs-on: windows-latest

    steps:
    - uses: actions/checkout@v2

    - name: Setup .NET 10
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: '10.0.x'

    - name: Restore dependencies
      run: dotnet restore

    - name: Build
      run: dotnet build --configuration Release

    - name: Run unit tests
      run: dotnet test --configuration Release --logger trunit

    - name: Run code coverage
      run: dotnet test --collect:"XPlat Code Coverage"
SHELL

在Visual Studio 2026中對GitHub Actions的原生支援讓設定Iron Software專案的CI/CD流水線變得簡單明瞭。

社群資源與第三方見解

開發者社群一直在積極討論Visual Studio 2026的功能。 根據InfoWorld的報導,Visual Studio 2026被描述為一個"AI原生智能開發環境",除了AI驅動的除錯、分析等功能外,還具有性能和使用者體驗的改進。

來自Techzine Global的另一個觀點強調,"Visual Studio 2026 現在的啟動速度比其前身顯著加快。 對於大型專案,停滯已減少超過50%。這種改進的穩定性在使用可能處理大型文件的文件處理程式庫時特別有利。

對於有興趣了解Visual Studio 2026功能在Iron Software整合之外的開發者來說,像Medium和科技新聞網站這樣的平台上的社群討論提供了對實際使用經驗和最佳實踐的寶貴見解。

從Visual Studio 2022無縫遷移

2022年版本與更新的2026年版本的UI比較

Visual Studio 2026 的主要優勢之一是其與現有專案的相容性。 如版本說明中所述,Visual Studio 2026 與 Visual Studio 2022 的專案和擴充功能相容,不需要遷移步驟。 這意味著:

  • 現有的Iron Software專案無需修改即可立即開啟

超過 4,000 個 VS 2022 擴展在 VS 2026 中運作

並排安裝允許逐步過渡

  • IDE與建置工具解耦,防止工具鏈中斷。

開發者可以安全地將Visual Studio 2026安裝在現有的Visual Studio 2022安裝旁,並評估Iron Software產品在新環境中的性能,而沒有風險。

性能優化提示

記憶體管理

處理大型文件時,請考慮這些優化策略:

using IronPdf;
using System;

public class OptimizedPdfProcessor
{
    public void ProcessLargeDocument(string htmlPath)
    {
        // Use using statements for proper disposal
        using var renderer = new ChromePdfRenderer();

        // Configure for memory efficiency
        renderer.RenderingOptions.CssMediaType = PdfCssMediaType.Print;
        renderer.RenderingOptions.PaperSize = PdfPaperSize.A4;

        // Process in chunks if possible
        var html = File.ReadAllText(htmlPath);
        using var pdf = renderer.RenderHtmlAsPdf(html);

        // Save immediately to free memory
        pdf.SaveAs("output.pdf");

        // PDF is disposed automatically
    }
}
using IronPdf;
using System;

public class OptimizedPdfProcessor
{
    public void ProcessLargeDocument(string htmlPath)
    {
        // Use using statements for proper disposal
        using var renderer = new ChromePdfRenderer();

        // Configure for memory efficiency
        renderer.RenderingOptions.CssMediaType = PdfCssMediaType.Print;
        renderer.RenderingOptions.PaperSize = PdfPaperSize.A4;

        // Process in chunks if possible
        var html = File.ReadAllText(htmlPath);
        using var pdf = renderer.RenderHtmlAsPdf(html);

        // Save immediately to free memory
        pdf.SaveAs("output.pdf");

        // PDF is disposed automatically
    }
}
Imports IronPdf
Imports System
Imports System.IO

Public Class OptimizedPdfProcessor
    Public Sub ProcessLargeDocument(htmlPath As String)
        ' Use Using blocks for proper disposal
        Using renderer As New ChromePdfRenderer()

            ' Configure for memory efficiency
            renderer.RenderingOptions.CssMediaType = PdfCssMediaType.Print
            renderer.RenderingOptions.PaperSize = PdfPaperSize.A4

            ' Process in chunks if possible
            Dim html As String = File.ReadAllText(htmlPath)
            Using pdf = renderer.RenderHtmlAsPdf(html)

                ' Save immediately to free memory
                pdf.SaveAs("output.pdf")

                ' PDF is disposed automatically
            End Using
        End Using
    End Sub
End Class
$vbLabelText   $csharpLabel

Visual Studio 2026中的淨分配工具可識別文件處理程式碼中的記憶體效率低下。

批量處理

為了處理多個文件,實現批次處理並適當管理資源:

using IronPdf;
using System.Collections.Concurrent;
using System.Threading.Tasks;

public class BatchProcessor
{
    public async Task ProcessDocumentsBatch(IEnumerable<string> filePaths)
    {
        var options = new ParallelOptions
        {
            MaxDegreeOfParallelism = Environment.ProcessorCount
        };

        await Parallel.ForEachAsync(filePaths, options, async (path, ct) =>
        {
            using var renderer = new ChromePdfRenderer();
            var html = await File.ReadAllTextAsync(path, ct);
            var pdf = renderer.RenderHtmlAsPdf(html);

            var outputPath = Path.ChangeExtension(path, ".pdf");
            pdf.SaveAs(outputPath);
        });
    }
}
using IronPdf;
using System.Collections.Concurrent;
using System.Threading.Tasks;

public class BatchProcessor
{
    public async Task ProcessDocumentsBatch(IEnumerable<string> filePaths)
    {
        var options = new ParallelOptions
        {
            MaxDegreeOfParallelism = Environment.ProcessorCount
        };

        await Parallel.ForEachAsync(filePaths, options, async (path, ct) =>
        {
            using var renderer = new ChromePdfRenderer();
            var html = await File.ReadAllTextAsync(path, ct);
            var pdf = renderer.RenderHtmlAsPdf(html);

            var outputPath = Path.ChangeExtension(path, ".pdf");
            pdf.SaveAs(outputPath);
        });
    }
}
Imports IronPdf
Imports System.Collections.Concurrent
Imports System.Threading.Tasks

Public Class BatchProcessor
    Public Async Function ProcessDocumentsBatch(filePaths As IEnumerable(Of String)) As Task
        Dim options As New ParallelOptions With {
            .MaxDegreeOfParallelism = Environment.ProcessorCount
        }

        Await Parallel.ForEachAsync(filePaths, options, Async Function(path, ct)
            Using renderer As New ChromePdfRenderer()
                Dim html As String = Await File.ReadAllTextAsync(path, ct)
                Dim pdf = renderer.RenderHtmlAsPdf(html)

                Dim outputPath As String = Path.ChangeExtension(path, ".pdf")
                pdf.SaveAs(outputPath)
            End Using
        End Function)
    End Function
End Class
$vbLabelText   $csharpLabel

結論

Visual Studio 2026是.NET開發工具的一次重大飛躍,它具有AI驅動的開發功能,提升了性能,並且重新設計的介面符合現代設計原則。 最新版本提供了一個出色的環境,用於處理Iron Software全面的文件處理程式庫套件。

所有Iron Software產品,包括IronPDFIronOCRIronBarcodeIronXL,都能在Visual Studio 2026中順暢高效地運行。由於完全支援.NET 10並無縫相容最新的C# 14語言功能,開發人員可以自信地在Microsoft最新的IDE中使用這些強大的程式庫構建穩健的文件處理應用程式。

結合 Visual Studio 2026 增強的偵錯功能、GitHub Copilot 整合、改進的程式碼涵蓋工具和效能剖析功能,創造出一個理想的開發環境,用於實現複雜的文件工作流程。 無論您是從HTML生成PDF使用OCR從影像中提取文字讀取和寫入條碼,還是操作Excel試算表,Iron Software產品可以無縫整合到Visual Studio 2026的新功能和能力中。

改善的性能,包括更快的解決方案載入、縮短的建置時間和更好的記憶體管理,確保開發者即使在涉及大量文件處理的大型專案中,仍能高效地工作。 現在,社群版和專業版都包含了程式碼覆蓋率分析,使使用Iron Software程式庫的應用程式開發者能夠普遍獲得這些基本測試工具,以確保應用程式的品質。

對於希望利用最新的IDE技術和文件處理能力進行開發的開發者來說,Visual Studio 2026 與 Iron Software產品的結合,提供了強大且現代化的開發體驗。 無縫整合、全面支援.NET 10,以及增強的生產力功能,使其成為構建需要複雜文件處理能力的新一代.NET應用程式的最佳選擇。

隨著Visual Studio 2026和Iron Software不斷通過自動月度更新和定期功能增強來演進,開發者可以期待一個日益精緻和強大的開發體驗。 .NET 文件處理的未來已經來臨,而且在 Visual Studio 2026 中運行得非常出色。


如需了解有關Iron Software產品及其功能的更多資訊,請造訪ironsoftware.com或探索每款產品提供的全面文件和教程。