Click here to Skip to main content
15,908,172 members
Home / Discussions / C#
   

C#

 
GeneralRe: which is preferable Pin
Rajesh R Subramanian11-Jun-09 0:27
professionalRajesh R Subramanian11-Jun-09 0:27 
GeneralRe: which is preferable Pin
0x3c011-Jun-09 1:48
0x3c011-Jun-09 1:48 
GeneralRe: which is preferable Pin
Dave Kreskowiak11-Jun-09 3:49
mveDave Kreskowiak11-Jun-09 3:49 
AnswerRe: which is preferable Pin
Luc Pattyn11-Jun-09 2:57
sitebuilderLuc Pattyn11-Jun-09 2:57 
AnswerRe: which is preferable Pin
Vasudevan Deepak Kumar11-Jun-09 4:40
Vasudevan Deepak Kumar11-Jun-09 4:40 
GeneralRe: which is preferable Pin
Vijjuuu.11-Jun-09 19:46
Vijjuuu.11-Jun-09 19:46 
Question[Message Deleted] Pin
hkjghkj110-Jun-09 22:59
hkjghkj110-Jun-09 22:59 
AnswerRe: midi player Pin
Christian Graus10-Jun-09 23:07
protectorChristian Graus10-Jun-09 23:07 
AnswerRe: midi player Pin
DaveyM6911-Jun-09 0:34
professionalDaveyM6911-Jun-09 0:34 
AnswerRe: midi player Pin
DaveyM6911-Jun-09 1:00
professionalDaveyM6911-Jun-09 1:00 
Questionhow to save image into sql server ? Pin
xingselex10-Jun-09 22:22
xingselex10-Jun-09 22:22 
AnswerRe: how to save image into sql server ? Pin
Leonscape10-Jun-09 22:58
Leonscape10-Jun-09 22:58 
Questionbreakpoints to all the functions inside a .cs file Pin
LiYS10-Jun-09 21:51
LiYS10-Jun-09 21:51 
AnswerRe: breakpoints to all the functions inside a .cs file Pin
Manas Bhardwaj10-Jun-09 22:00
professionalManas Bhardwaj10-Jun-09 22:00 
AnswerRe: breakpoints to all the functions inside a .cs file Pin
Rob Philpott10-Jun-09 22:13
Rob Philpott10-Jun-09 22:13 
AnswerRe: breakpoints to all the functions inside a .cs file [modified] Pin
DaveyM6910-Jun-09 22:33
professionalDaveyM6910-Jun-09 22:33 
AnswerRe: breakpoints to all the functions inside a .cs file Pin
S. Senthil Kumar10-Jun-09 23:27
S. Senthil Kumar10-Jun-09 23:27 
Macro recording won't work, but you can write a macro that does the job. Here's what I came up with - it basically goes to each method in the currently open file and adds a breakpoint to the first line of the method.

Imports System
Imports EnvDTE
Imports EnvDTE80
Imports System.Diagnostics

Public Module Module1
    Public Sub AutoBreakPoint()
        ProcessFile()
    End Sub

    Function ProcessFile()

        Dim selection As EnvDTE.TextSelection
        Dim projectItem As ProjectItem
        Dim fileCodeModel As FileCodeModel
        Dim codeElement As CodeElement
        Dim i As Integer

        Dim currentFunction As CodeFunction

        projectItem = DTE.ActiveDocument.ProjectItem

        fileCodeModel = projectItem.FileCodeModel
        For i = 1 To fileCodeModel.CodeElements.Count
            codeElement = fileCodeModel.CodeElements.Item(i)
            ProcessCodeElement(codeElement)
        Next

        selection = DTE.ActiveDocument.Selection
        selection.SelectAll()
        selection.SmartFormat()

    End Function

    Sub ProcessNamespace(ByVal namespaceElement As CodeNamespace)
        Dim i As Integer
        Dim codeElement As CodeElement

        For i = 1 To namespaceElement.Members.Count
            codeElement = namespaceElement.Members.Item(i)
            ProcessCodeElement(codeElement)
        Next
    End Sub
    Sub ProcessCodeElement(ByVal codeElement As CodeElement)
        If codeElement.Kind = vsCMElement.vsCMElementNamespace Then
            ProcessNamespace(codeElement)
        ElseIf codeElement.Kind = vsCMElement.vsCMElementClass Then
            ProcessType(codeElement)
        ElseIf codeElement.Kind = vsCMElement.vsCMElementFunction Then
            ProcessMethod(codeElement)
        End If
    End Sub
    Sub ProcessType(ByVal typeElement As CodeClass)
        Dim i As Integer
        Dim codeElement As CodeElement

        For i = 1 To typeElement.Members.Count
            codeElement = typeElement.Members.Item(i)
            If codeElement.Kind = vsCMElement.vsCMElementFunction Then
                ProcessMethod(codeElement)
            ElseIf codeElement.Kind = vsCMElement.vsCMElementClass Then
                ProcessType(codeElement)
            End If
        Next
    End Sub

    Sub ProcessMethod(ByVal methodElement As CodeFunction)
        Dim selection As EnvDTE.TextSelection
        Dim editPoint As EnvDTE.EditPoint
        Dim verifyPoint As EnvDTE.TextPoint
        Dim endPointAbsCharOffset As Integer
        Dim column As Integer
        Dim methodRunNotifierSignature As String
        Dim functionStartCode As String
        Dim functionEndCode As String
        Dim parameters As String
        Dim parameter As EnvDTE80.CodeParameter2
        Dim i As Integer

        If methodElement.MustImplement Then
            Return
        End If

        selection = DTE.ActiveDocument.Selection
        editPoint = selection.ActivePoint.CreateEditPoint()
        verifyPoint = selection.ActivePoint.CreateEditPoint()

        ' Move to start of method
        editPoint.MoveToPoint(methodElement.GetStartPoint(vsCMPart.vsCMPartBody))
        selection.MoveToPoint(editPoint)
        verifyPoint.MoveToPoint(methodElement.GetStartPoint(vsCMPart.vsCMPartBody))

        DTE.Debugger.Breakpoints.Add(methodElement.Name)

    End Sub
End Module


Regards
Senthil [MVP - Visual C#]
_____________________________
My Home Page |My Blog | My Articles | My Flickr | WinMacro

GeneralRe: breakpoints to all the functions inside a .cs file Pin
LiYS10-Jun-09 23:47
LiYS10-Jun-09 23:47 
QuestionProblem in setup and deployment Pin
vijaylumar10-Jun-09 21:46
vijaylumar10-Jun-09 21:46 
AnswerRe: Problem in setup and deployment Pin
Manas Bhardwaj10-Jun-09 22:02
professionalManas Bhardwaj10-Jun-09 22:02 
GeneralRe: Problem in setup and deployment Pin
vijaylumar10-Jun-09 23:05
vijaylumar10-Jun-09 23:05 
GeneralRe: Problem in setup and deployment Pin
Manas Bhardwaj10-Jun-09 23:43
professionalManas Bhardwaj10-Jun-09 23:43 
GeneralRe: Problem in setup and deployment Pin
vijaylumar14-Jun-09 19:18
vijaylumar14-Jun-09 19:18 
QuestionGetting serial ports names problem [modified] Pin
enginço10-Jun-09 21:01
enginço10-Jun-09 21:01 
AnswerRe: Getting serial ports names problem Pin
Eddy Vluggen10-Jun-09 22:38
professionalEddy Vluggen10-Jun-09 22:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.