Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ImportedProjects
SVG
Commits
38d6c5e2
Commit
38d6c5e2
authored
Feb 06, 2018
by
Vadim Zaslavsky
Committed by
mrbean-bremen
Dec 22, 2018
Browse files
Case insensitive enum parsing fixed
parent
b07559d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Source/Painting/EnumConverters.cs
View file @
38d6c5e2
...
@@ -305,13 +305,16 @@ namespace Svg
...
@@ -305,13 +305,16 @@ namespace Svg
[
CLSCompliant
(
false
)]
[
CLSCompliant
(
false
)]
public
static
bool
TryParse
<
TEnum
>(
string
value
,
out
TEnum
result
)
where
TEnum
:
struct
,
IConvertible
public
static
bool
TryParse
<
TEnum
>(
string
value
,
out
TEnum
result
)
where
TEnum
:
struct
,
IConvertible
{
{
var
retValue
=
value
==
null
?
try
false
:
{
Enum
.
IsDefined
(
typeof
(
TEnum
),
value
);
result
=
(
TEnum
)
Enum
.
Parse
(
typeof
(
TEnum
),
value
,
true
);
result
=
retValue
?
return
true
;
(
TEnum
)
Enum
.
Parse
(
typeof
(
TEnum
),
value
)
:
}
default
(
TEnum
);
catch
return
retValue
;
{
result
=
default
(
TEnum
);
return
false
;
}
}
}
}
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment