當前位置: 首頁>>代碼示例>>C#>>正文


C# ThreadMirror.GetType方法代碼示例

本文整理匯總了C#中Mono.Debugger.Soft.ThreadMirror.GetType方法的典型用法代碼示例。如果您正苦於以下問題:C# ThreadMirror.GetType方法的具體用法?C# ThreadMirror.GetType怎麽用?C# ThreadMirror.GetType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Mono.Debugger.Soft.ThreadMirror的用法示例。


在下文中一共展示了ThreadMirror.GetType方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: DoGetType

        private TypeMirror DoGetType(ThreadMirror thread, string proxyTypeName, string originalTypeName)
        {
            TypeMirror type = thread.GetType(proxyTypeName);

            if (type != null && type.FullName.Length > 2 && type.FullName[type.FullName.Length - 2] == '`')
            {
                // The proxy type is an unbound generic so we need to bind the type arguments using
                // the original type. Proxy will be a name like "System.Collections.Generic.CollectionDebuggerView`1"
                // original will be a name like "System.Collections.Generic.List`1[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]".
                int i = originalTypeName.IndexOf('`');
                if (i > 0 && i + 1 < originalTypeName.Length && originalTypeName[i + 1] == type.FullName[type.FullName.Length - 1])
                {
                    proxyTypeName = type.FullName + originalTypeName.Substring(i + 2);
                    Log.WriteLine(TraceLevel.Verbose, "Debugger", "using {0} for {1}", proxyTypeName, originalTypeName);
                    type = thread.GetType(proxyTypeName);
                }
                else
                {
                    // Either the original type is not generic or the number of generic arguments does not match.
                    Log.WriteLine(TraceLevel.Error, "Debugger", "DoGetType> {0} and {1} are not compatible", originalTypeName, proxyTypeName);
                }
            }
            else if (type != null)
            {
                Log.WriteLine(TraceLevel.Verbose, "Debugger", "used {0} for {1}", proxyTypeName, originalTypeName);
            }

            return type;
        }
開發者ID:andyhebear,項目名稱:Continuum,代碼行數:29,代碼來源:VariableItem.cs


注:本文中的Mono.Debugger.Soft.ThreadMirror.GetType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。