How can specify new value for default system enum [duplicate] - c#

This question already has answers here:
Can I add an enum to an existing .NET Structure, like Date?
(3 answers)
Closed 8 years ago.
I have one question
How can I specify new value into system enum?
For example, the LoginFailureAction has a enum that define with microsoft in c# how can I get new value into this enum?

Of course, you can't change the default value of a type. The type is the type, and you can't change it.

Related

Undefine a keyword in C# [duplicate]

This question already has answers here:
How can I use a reserved keyword as an identifier in my JSON model class?
(3 answers)
How do I use a C# keyword as a property name?
(1 answer)
Closed 3 years ago.
I am currently working on an c# application that uses the spotify api. For the parsing of the Newtonsoft stuff I am using Newtonsoft.Json. But when receiving a track, the json includes a key explicit, and explicit is a keyword. So my question is, if there is a way to give the track class a member called explicit
Use the # prefix to escape reserved keywords.
var #explicit = ...

Unable to find workaround for color conversion [duplicate]

This question already has answers here:
C# Converting delphi TColor to color (Hex)
(2 answers)
Closed 9 years ago.
I have an old application which uses devexpress scheduler, and i am working on new application for it. My problem is in database it has field "LABELCOLOR" of type int. It has values like 536870912, 6610596, 8689404, etc.
Now i need to convert these values to hexadecimal color format using c#, but unable to find any reference how can i do it. I believe these values are integer representation of Delphi colors.
Please guide.
Thanks in advance.
C#: Console.WriteLine(8689404.ToString("X6"));

Override Tostring() of enum to accommodate runtime string changes [duplicate]

This question already has answers here:
How can I internationalize strings representing C# enum values?
(2 answers)
How do I have an enum bound combobox with custom string formatting for enum values?
(21 answers)
Enum ToString with user friendly strings
(25 answers)
Closed 10 years ago.
I have an enum like this
enum Animal:byte
{
Cat=0,
Dog=1,
Horse=2
}
I want to override the ToString() of it to to write a custom string because my application is a multi-language one(Cat.ToString() should retrieve the translated word of cat). so the Description keyowrd can't be used here.can anyone give me a hint to find a neat way to solve this?

C# Enum compiler bug/glitch? [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
.NET Enumeration allows comma in the last field
i noticed while i was refreshing my memory on c# that with enums, you dont get a complaint from the compiler when you leave a comma after the last variable... EG
enum fruit {
apple,
pear,
watermelon,
}
i was wondering you can do this? shouldnt the compiler say "syntax error: ," or something?
It is part of the C# specification, the compiler is simply following it.
Document: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-334.pdf
Page 363, Section 19.7

C# Double.ToString() [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Custom numeric format string to always display the sign
To format a double to certain precision in C# I write this:
d.ToString("#0.00");
What if I want to force a the sign to appear..
e.g
+2.54 and -2.54
Hope this will work.
YourDoublenumber.ToString("+#;#");

Categories

Resources