MDC Get Method | Apache log4net™ SDK Documentation

Gets the context value identified by the key parameter.

Namespace: log4net
Assembly: log4net (in log4net.dll) Version: 2.0.8.0-.NET 4.0
Syntax

C#
VB
C++
F#
Copy

    public static string Get(
    	string key
    )

    Public Shared Function Get (
    	key As String
    ) As String

    public:
    static String^ Get(
    	String^ key
    )

    static member Get :
            key : string -> string

#### Parameters

key
  Type: System
  String
  The key to lookup in the MDC.

#### Return Value

Type: String
The string value held for the key, or a null reference if no corresponding value is found.
Remarks

Note
The MDC is deprecated and has been replaced by the Properties. The current MDC implementation forwards to the ThreadContext.Properties.

If the key parameter does not look up to a previously defined context then null will be returned.

See Also

#### Reference

MDC Class
log4net Namespace