ConfigurationElement.IsReadOnly メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ConfigurationElement.IsReadOnly メソッドの意味・解説 

ConfigurationElement.IsReadOnly メソッド

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

ConfigurationElement オブジェクト読み取り専用かどうかを示す値を取得します

名前空間: System.Configuration
アセンブリ: System.Configuration (system.configuration.dll 内)
構文構文

Public Overridable Function
 IsReadOnly As Boolean
Dim instance As ConfigurationElement
Dim returnValue As Boolean

returnValue = instance.IsReadOnly
public virtual bool IsReadOnly ()
public:
virtual bool IsReadOnly ()
public boolean IsReadOnly ()

戻り値
ConfigurationElement オブジェクト読み取り専用場合trueそれ以外場合false

解説解説

システムによって定義されている構成要素は、変更できません。

変更できる要素確認するには、IsReadOnly メソッド使用します

使用例使用例

IsReadOnly メソッド使用する方法の例を次に示します。これは、カスタム セクション使用されfalse返します

' Show how to use IsReadOnly.
' It loops to see if the elements are read only. 
Shared Sub ReadOnlyElements() 
    Try
        ' Get the current configuration file.
        Dim config _
        As System.Configuration.Configuration = _
        ConfigurationManager.OpenExeConfiguration( _
        ConfigurationUserLevel.None)

        ' Get the MyUrls section.
        Dim myUrlsSection As UrlsSection =
 _
        config.GetSection("MyUrls")
        
        Dim elements As UrlsCollection = _
        myUrlsSection.Urls
                   
        Dim elemEnum As IEnumerator = _
        elements.GetEnumerator()
        
        Dim i As Integer
 = 0
        Console.WriteLine(elements.Count.ToString())
        
        While elemEnum.MoveNext()
            Console.WriteLine("The element {0} is read only: {1}",
 _
            elements(i).Name, elements(i).IsReadOnly().ToString())
            i += 1
        End While
    Catch err As ConfigurationErrorsException
        Console.WriteLine("[ReadOnlyElements: {0}]",
 _
        err.ToString())
    End Try

End Sub 'ReadOnlyElements

// Show how to use IsReadOnly.
// It loops to see if the elements are read only. 
static void ReadOnlyElements()
{
    try
    {
        // Get the configuration file.
        System.Configuration.Configuration config =
            ConfigurationManager.OpenExeConfiguration(
            ConfigurationUserLevel.None);

        // Get the MyUrls section.
        UrlsSection myUrlsSection =
            config.GetSection("MyUrls") as UrlsSection;


        UrlsCollection elements = myUrlsSection.Urls;


        IEnumerator elemEnum =
            elements.GetEnumerator();

        int i = 0;
        Console.WriteLine(elements.Count.ToString());

        while (elemEnum.MoveNext())
        {
            Console.WriteLine("The element {0} is read only: {1}",
             elements[i].Name, 
             elements[i].IsReadOnly().ToString());
            i += 1;
        }
    }
    catch (ConfigurationErrorsException err)
    {
        Console.WriteLine("[ReadOnlyElements: {0}]",
            err.ToString());
    }

}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ConfigurationElement クラス
ConfigurationElement メンバ
System.Configuration 名前空間


このページでは「.NET Framework クラス ライブラリ リファレンス」からConfigurationElement.IsReadOnly メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からConfigurationElement.IsReadOnly メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からConfigurationElement.IsReadOnly メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

ConfigurationElement.IsReadOnly メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ConfigurationElement.IsReadOnly メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS