如何将Option Explicit
Public Sub GetInfo()
Dim IE As New InternetExplorer
Application.ScreenUpdating = False
With IE
.Visible = True
.navigate "http://www.bursamalaysia.com/market/listed-companies/company-announcements/#/?category=SH&sub_category=all&alphabetical=All"
While .Busy Or .readyState < 4: DoEvents: Wend
Dim links As Object, i As Long
Set links = .document.querySelectorAll("#bm_ajax_container [href^='/market/listed-companies/company-announcements/']")
For i = 0 To links.Length - 1
With ThisWorkbook.Worksheets("Sheet1")
.Cells(i + 1, 1) = links.item(i)
End With
Next i
.Quit
End With
Application.ScreenUpdating = True
End Sub
或Enumerable
存储到List
中?我刚开始编程,并试图从这里的文章中了解:
会是这个吗?
MemoryCache
我的代码:
IMemoryCache _cache;
var testdata = productcategoryrepository.GetAllProductCategory();
_cache.Set("Teststore", testdata);
答案 0 :(得分:0)
这似乎可行:
public class HomeController : Controller
{
private readonly IMemoryCache _cache;
public HomeController(IMemoryCache cache)
{
_cache = cache;
}
public IActionResult Index()
{
var testdata = productcategoryrepository.GetAllProductCategory();
_cache.Set("Teststore", testdata);
return View();
}
}