26 references to ToObject
dotnet-svcutil-lib (3)
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializationWriterILGen.cs (3)
649ilg.Ldc(Enum.ToObject(mapping.TypeDesc.Type, c.Value)); 2388eValue = Enum.ToObject(choiceMapping.TypeDesc.Type, choiceMapping.Constants[i].Value); 2402eValue = Enum.ToObject(choiceMapping.TypeDesc.Type, choiceMapping.Constants[i].Value);
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
ObjectSerializationTests.cs (1)
96? (T)Enum.ToObject(typeof(T), r.ReadInt64())
Microsoft.VisualBasic.Core (1)
Microsoft\VisualBasic\CompilerServices\Conversions.vb (1)
2402If IsEnum(TargetType) Then Return [Enum].ToObject(TargetType, Expression)
System.ComponentModel.TypeConverter (4)
System\ComponentModel\EnumConverter.cs (4)
95return Enum.ToObject(EnumType, convertedValue); 115return Enum.ToObject(EnumType, finalValue); 198flagValues.Add((Enum)Enum.ToObject(EnumType, ul)); 213flagValues.Add((Enum)Enum.ToObject(EnumType, longValue));
System.Formats.Asn1 (2)
System\Formats\Asn1\AsnDecoder.Enumerated.cs (1)
234return (Enum)Enum.ToObject(enumType, value);
System\Formats\Asn1\AsnDecoder.NamedBitList.cs (1)
272ret = (Enum)Enum.ToObject(flagsEnumType, InterpretNamedBitListReversed(valueSpan));
System.Linq.Expressions (1)
System\Linq\Expressions\Interpreter\TypeOperations.cs (1)
429frame.Push(Enum.ToObject(_t, (long)from));
System.Private.CoreLib (6)
src\libraries\System.Private.CoreLib\src\System\Enum.cs (3)
2202case TypeCode.Int64: return ToObject(enumType, (long)value); 2208case TypeCode.Boolean: return ToObject(enumType, (bool)value ? 1L : 0L); 2217if (valueType == typeof(nint)) return ToObject(enumType, (nint)value);
src\libraries\System.Private.CoreLib\src\System\Reflection\InvokeUtils.cs (2)
57dstObject = dstType.IsEnum ? Enum.ToObject(dstType, longValue) : longValue; 77dstObject = dstType.IsEnum ? Enum.ToObject(dstType, (long)ulongValue) : ulongValue;
src\System\Reflection\MdConstant.cs (1)
75return Enum.ToObject(fieldType, defaultValue);
System.Private.DataContractSerialization (1)
System\Runtime\Serialization\Json\JsonEnumDataContract.cs (1)
34enumValue = Enum.ToObject(TraditionalDataContract.UnderlyingType, jsonReader.ReadElementContentAsLong());
System.Private.Xml (6)
System\Xml\Serialization\ReflectionXmlSerializationReader.cs (1)
1270return Enum.ToObject(mapping.TypeDesc!.Type!, ToEnum(source, table, mapping.TypeDesc.Name));
System\Xml\Serialization\XmlSerializationReaderILGen.cs (2)
993ilg.Ldc(Enum.ToObject(mapping.TypeDesc!.Type!, constants[i].Value)); 1096retValues.Add(Enum.ToObject(mapping.TypeDesc.Type!, c.Value));
System\Xml\Serialization\XmlSerializationWriterILGen.cs (3)
634ilg.Ldc(Enum.ToObject(mapping.TypeDesc.Type!, c.Value)); 2253eValue = Enum.ToObject(choiceMapping.TypeDesc!.Type!, choiceMapping.Constants[i].Value); 2267eValue = Enum.ToObject(choiceMapping.TypeDesc!.Type!, choiceMapping.Constants[i].Value);
System.Windows.Forms (1)
System\Windows\Forms\Input\KeysConverter.cs (1)
206return Enum.ToObject(typeof(Keys), finalValue);