Click here to Skip to main content
15,923,852 members
Home / Discussions / C#
   

C#

 
AnswerRe: how does insert text inside a bitmap? Pin
Adam Goossens11-Jul-05 0:42
Adam Goossens11-Jul-05 0:42 
GeneralSetROP2 Pin
Rassul Yunussov10-Jul-05 23:51
Rassul Yunussov10-Jul-05 23:51 
GeneralRe: SetROP2 Pin
Andrew Kirillov11-Jul-05 0:19
Andrew Kirillov11-Jul-05 0:19 
QuestionHow to Color Root Nodes and Child Nodes Seperately? Pin
pubududilena10-Jul-05 23:48
pubududilena10-Jul-05 23:48 
AnswerRe: How to Color Root Nodes and Child Nodes Seperately? Pin
S. Senthil Kumar11-Jul-05 1:09
S. Senthil Kumar11-Jul-05 1:09 
GeneralRe: How to Color Root Nodes and Child Nodes Seperately? Pin
Alomgir Miah11-Jul-05 6:24
Alomgir Miah11-Jul-05 6:24 
AnswerRe: How to Color Root Nodes and Child Nodes Seperately? Pin
Alomgir Miah11-Jul-05 8:25
Alomgir Miah11-Jul-05 8:25 
GeneralPrivate variable -> Public property macro Pin
Jan R Hansen10-Jul-05 23:35
Jan R Hansen10-Jul-05 23:35 
Hi,

I've just had to expose a load of private members as public properties, and thought that regex should be able to do the trick. It did. Use the following:

search for
{.*}private {:c+} m_{:a+};

replace with
\1public \2 \3\n\1\{\n\1\tget \{ return m_\3; \}\n\1\tset \{ m_\3 = value; \}\n\1\}\n

Remember to enable regex.

Or save the following macro:

Sub PrivatesToProperties()<br />
    DTE.ExecuteCommand("Edit.Replace")<br />
    DTE.Find.ReplaceWith = "\1public \2 \3\n\1\{\n\1\tget \{ return m_\3; \}\n\1\tset \{ m_\3 = value; \}\n\1\}\n"<br />
    DTE.Find.FindWhat = "{.*}private {:c+} m_{:a+};"<br />
    DTE.Find.ReplaceWith = "\1public \2 \3\n\1\{\n\1\tget \{ return m_\3; \}\n\1\tset \{ m_\3 = value; \}\n\1\}\n"<br />
    DTE.Find.Target = vsFindTarget.vsFindTargetCurrentDocumentSelection<br />
    DTE.Find.MatchCase = False<br />
    DTE.Find.MatchWholeWord = False<br />
    DTE.Find.MatchInHiddenText = True<br />
    DTE.Find.PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxRegExpr<br />
    DTE.Find.ResultsLocation = vsFindResultsLocation.vsFindResultsNone<br />
    DTE.Find.Action = vsFindAction.vsFindActionReplaceAll<br />
    DTE.Find.Execute()<br />
    DTE.Windows.Item(Constants.vsWindowKindFindReplace).Close()<br />
End Sub


It will convert this:

private int m_blabla;
private string m_moreBla;

to this:

public int blabla
{
get { return m_blabla; }
set { m_blabla = value; }
}

public string moreBla
{
get { return m_moreBla; }
set { m_moreBla = value; }
}

but requires that you start with privates that are prefixed with "m_". And it doesn't uppercase the properties (blabla should be Blabla) - but the world isn't perfect Smile | :)

Just a tip - many of you probably already know it, but I didn't find it on CP so here it is.

/Jan

Do you know why it's important to make fast decisions? Because you give yourself more time to correct your mistakes, when you find out that you made the wrong one. Chris Meech on deciding whether to go to his daughters graduation or a Neil Young concert
QuestionPerformace of exceptions? Pin
Dr Herbie10-Jul-05 23:21
Dr Herbie10-Jul-05 23:21 
AnswerRe: Performace of exceptions? Pin
leppie11-Jul-05 0:46
leppie11-Jul-05 0:46 
AnswerRe: Performace of exceptions? Pin
Guffa11-Jul-05 2:51
Guffa11-Jul-05 2:51 
AnswerRe: Performace of exceptions? Pin
Kevin McFarlane11-Jul-05 3:20
Kevin McFarlane11-Jul-05 3:20 
AnswerRe: Performace of exceptions? Pin
J4amieC11-Jul-05 3:35
J4amieC11-Jul-05 3:35 
AnswerRe: Performace of exceptions? Pin
Matt Gerrans11-Jul-05 9:02
Matt Gerrans11-Jul-05 9:02 
QuestionExcel bookmarks? Pin
Christer Claesson10-Jul-05 23:05
Christer Claesson10-Jul-05 23:05 
GeneralForms in ASP.Net Pin
pakFari10-Jul-05 23:03
pakFari10-Jul-05 23:03 
GeneralRe: Forms in ASP.Net Pin
MoustafaS11-Jul-05 2:18
MoustafaS11-Jul-05 2:18 
GeneralSQL question Pin
Rassul Yunussov10-Jul-05 22:34
Rassul Yunussov10-Jul-05 22:34 
GeneralRe: SQL question Pin
Guffa11-Jul-05 4:51
Guffa11-Jul-05 4:51 
GeneralComponent Control for Windows CE Pin
hung le quoc10-Jul-05 21:29
hung le quoc10-Jul-05 21:29 
GeneralSQL query help Pin
Anonymous10-Jul-05 19:26
Anonymous10-Jul-05 19:26 
GeneralRe: SQL query help Pin
Sheo Narayan10-Jul-05 19:54
Sheo Narayan10-Jul-05 19:54 
GeneralRe: SQL query help Pin
Anonymous10-Jul-05 22:14
Anonymous10-Jul-05 22:14 
GeneralRe: SQL query help Pin
Sheo Narayan10-Jul-05 22:21
Sheo Narayan10-Jul-05 22:21 
QuestionAre Enum's best for this?? Pin
rmoen10-Jul-05 17:49
rmoen10-Jul-05 17:49 

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.