问题描述
我正在我的托管语言服务的parser.y/parser.cs文件中尝试执行以下操作,并且理解我在GetService上遇到错误. I am trying to do the following in my parser.y/parser.cs file of my managed language sercice and understandebly I get an error on GetService. DTE dte =( DTE ) 此 .GetService ( typeof ( DTE ))); DTE dte = (DTE)this.GetService(typeof(DTE)); Array activeProjects =( 数组 )dte.ActiveSolutionProjects; Array activeProjects = (Array)dte.ActiveSolutionProjects; 项目 activeProj =( 项目 )dte.ActiveDocument.ProjectItem.ContainingProject; 我的问题是Parser类无法使用Getservice,我想知道是否有任何方法可以访问DTE,或者是否有任何其他方法可以访问parser.cs/parser.y中的活动项目. /p> Project activeProj = (Project)dte.ActiveDocument.ProjectItem.ContainingProject; My problem is that Getservice is not availabe to the Parser class and I was wondering if there is any way to access DTE, or is there any other way to access the active project within the parser.cs/parser.y . 谢谢 Thanks 这篇关于我的语言服务的Parser.cs文件中的GetService DTE请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
感谢 推荐答案
DTE dte = this.GetService(typeof(SDTE)) as DTE;
kaku
kaku