SPRegionalSettings constructor (SPWeb)
初始化指定網站的SPRegionalSettings類別的新執行個體。
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'宣告
Public Sub New ( _
web As SPWeb _
)
'用途
Dim web As SPWeb
Dim instance As New SPRegionalSettings(web)
public SPRegionalSettings(
SPWeb web
)
參數
web
Type: Microsoft.SharePoint.SPWebSPWeb物件,代表要從中擷取地區設定的網站。
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | web是 null 。 |
備註
您可以使用SPRegionalSettings建構函式或RegionalSettings屬性來擷取指定之網站的地區設定物件。
Examples
下列程式碼範例會示範如何擷取網站集合的根網站的地區設定。
Dim siteCollection As New SPSite("https://localhost")
Try
Dim rootWebSite As SPWeb = siteCollection.RootWeb
Dim regionalsettings As New SPRegionalSettings(rootWebSite)
…
rootWebSite.Dispose()
Finally
siteCollection.Dispose()
End Try
using (SPSite oSiteCollection = new SPSite("https://localhost"))
{
using(SPWeb oWebsiteRoot = oSiteCollection.RootWeb)
{
SPRegionalSettings oRegionalSettings = new SPRegionalSettings(oWebsiteRoot);
...
}
}
注意事項 |
---|
Certain objects implement the IDisposable interface, and you must avoid retaining these objects in memory after they are no longer needed. For information about good coding practices, see Disposing Objects. |