How to create custom keywords C# [duplicate] - c#

This question already has answers here:
Is there a way to implement custom language features in C#?
(6 answers)
Closed 6 years ago.
I'm writing a library for personal use that greatly expands C# features, and I was wondering on something quite interesting... Is it possible to create you own keywords? For example, if, foreach, for etc.
The reason I want to do this can be found at my previous question.

No, you can not do that. Language keywords are defined in the language definition. You could probably use the open sourced parts (compilers, etc) and create your own version of them.

Related

Control.ProductName in WPF [duplicate]

This question already has answers here:
Application.ProductName equivalent in WPF?
(7 answers)
Closed 8 years ago.
Is there something similar to the following property in WPF?
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.productname(v=vs.110).aspx
Thanks.
Not that I know of. But you can easily create this method yourself.
The actual code used by WinForms has several levels of fallback: it first look for an AssemblyProductAttribute on the assembly defining the control, then at the file version and finally falls back to the first part of the namespace.
You can copy that logic (or the parts that are relevant to you) directly from .net source code: http://referencesource.microsoft.com/#System.Windows.Forms/ndp/fx/src/winforms/Managed/System/WinForms/Control.cs#f7c944851a004a6e

Adding Tooltip for Variable in IDE [duplicate]

This question already has answers here:
How to write comments / documentation for variables / fields / lists in VS 2010?
(6 answers)
Closed 8 years ago.
Is there a syntax in Visual Studio 2008 so that, in C# development, if one of my colleagues hovers over a variable, the tooltip brings up more information, like my comments? It displays that it's a local int, and while running displays a value, but I was wondering if there was a way to make it display a personal description. Sorry for the newbie question, but all my research kept bringing up very different things than what I was looking for.
This has a duplicate question, with an answer here
As I stated earlier one should use appropriate naming, and avoid using hungarian notation.

Hiding C# XML Documentation [duplicate]

This question already has answers here:
C# hide and unhide comments
(6 answers)
Closed 9 years ago.
I am using the C# XML style of documentation in my latest project (eg using ///<summary> stuff). I find this makes the source code a pain to read as it just becomes so long. Is there a way in Visual Studio to auto-collapse just these or do I have to use the collapse to definitions and re-expand functions?
Take a look here at the following post, I think it should help
http://www.helixoft.com/blog/archives/30?n=collapse-all-xml-comments-in-vb-net-or-c

Realtime complination in C# [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Is there a method that will evaluate a string and produce an integer (assuming the string is an equation) in C#
Hi all, i just wonder how to make a realtime complination in C#
For example: i have a string like this
string math = "1 + 2 + (4 - 6)";
And i want to complie it to get the result
How to do that? and is that the bad idea because i want to make a calculator in C#?
Edited:
The main question properly is that i want to do it in WP7, not exactly in C# windows lol, i tried all the solutions below but not at all is correct!
and is that the bad idea because i want to make a calculator in C#?
One problem with that is that your calculator language is probably supposed to be just a subset of C#. So using the C# compiler may be too flexible and allow arbitrary C#. Kind of like problems with SQL injection attacks.
Expresion Evalution is an application of STACK (Data Structure)
You can see these link If you want Sample projects
http://www.vbforums.com/showthread.php?t=397264
http://www.codeproject.com/KB/cs/runtime_eval.aspx
http://www.c-sharpcorner.com/uploadfile/mgold/codedomcalculator08082005003253am/codedomcalculator.aspx

C# - Which is the best alternative to ‘switch on type’? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
C# - Is there a better alternative than this to ‘switch on type’?
1.)
http://channel9.msdn.com/forums/TechOff/411739-switch-objectGetType-/?CommentID=411995
2.)
http://blogs.msdn.com/jaredpar/archive/2008/05/16/switching-on-types.aspx
3.)
Or is there an even better way....?
Please reflect both on speed and ease of reading the code.
Of all suggested I prefer second option. Generally, I prefer double dispatch over switching on Types.

Categories