117 references to TypeCode
Microsoft.CodeAnalysis.Workspaces (117)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.cs (79)
14using TypeCode = ObjectWriter.TypeCode; 157var code = (TypeCode)ReadByte(); 160case TypeCode.Null: return null; 161case TypeCode.Boolean_True: return true; 162case TypeCode.Boolean_False: return false; 163case TypeCode.Int8: return ReadSByte(); 164case TypeCode.UInt8: return ReadByte(); 165case TypeCode.Int16: return ReadInt16(); 166case TypeCode.UInt16: return ReadUInt16(); 167case TypeCode.Int32: return ReadInt32(); 168case TypeCode.Int32_1Byte: return (int)ReadByte(); 169case TypeCode.Int32_2Bytes: return (int)ReadUInt16(); 170case TypeCode.Int32_0: 171case TypeCode.Int32_1: 172case TypeCode.Int32_2: 173case TypeCode.Int32_3: 174case TypeCode.Int32_4: 175case TypeCode.Int32_5: 176case TypeCode.Int32_6: 177case TypeCode.Int32_7: 178case TypeCode.Int32_8: 179case TypeCode.Int32_9: 180case TypeCode.Int32_10: 181return (int)code - (int)TypeCode.Int32_0; 182case TypeCode.UInt32: return ReadUInt32(); 183case TypeCode.UInt32_1Byte: return (uint)ReadByte(); 184case TypeCode.UInt32_2Bytes: return (uint)ReadUInt16(); 185case TypeCode.UInt32_0: 186case TypeCode.UInt32_1: 187case TypeCode.UInt32_2: 188case TypeCode.UInt32_3: 189case TypeCode.UInt32_4: 190case TypeCode.UInt32_5: 191case TypeCode.UInt32_6: 192case TypeCode.UInt32_7: 193case TypeCode.UInt32_8: 194case TypeCode.UInt32_9: 195case TypeCode.UInt32_10: 196return (uint)((int)code - (int)TypeCode.UInt32_0); 197case TypeCode.Int64: return ReadInt64(); 198case TypeCode.UInt64: return ReadUInt64(); 199case TypeCode.Float4: return ReadSingle(); 200case TypeCode.Float8: return ReadDouble(); 201case TypeCode.Decimal: return ReadDecimal(); 202case TypeCode.Char: 205case TypeCode.StringUtf8: 206case TypeCode.StringUtf16: 207case TypeCode.StringRef_4Bytes: 208case TypeCode.StringRef_1Byte: 209case TypeCode.StringRef_2Bytes: 211case TypeCode.DateTime: 221var code = (TypeCode)ReadByte(); 224case TypeCode.Null: 227case TypeCode.EncodingName: 230case >= TypeCode.FirstWellKnownTextEncoding and <= TypeCode.LastWellKnownTextEncoding: 233case TypeCode.EncodingCodePage: 240static TextEncodingKind ToEncodingKind(TypeCode code) 242Debug.Assert(code is >= TypeCode.FirstWellKnownTextEncoding and <= TypeCode.LastWellKnownTextEncoding); 243return Microsoft.CodeAnalysis.EncodingExtensions.FirstTextEncodingKind + (byte)(code - TypeCode.FirstWellKnownTextEncoding); 308var kind = (TypeCode)ReadByte(); 309return kind == TypeCode.Null ? null : ReadStringValue(kind); 312private string ReadStringValue(TypeCode kind) 316TypeCode.StringRef_1Byte => _stringReferenceMap.GetValue(ReadByte()), 317TypeCode.StringRef_2Bytes => _stringReferenceMap.GetValue(ReadUInt16()), 318TypeCode.StringRef_4Bytes => _stringReferenceMap.GetValue(ReadInt32()), 319TypeCode.StringUtf16 or TypeCode.StringUtf8 => ReadStringLiteral(kind), 324private unsafe string ReadStringLiteral(TypeCode kind) 327if (kind == TypeCode.StringUtf8) 347=> (TypeCode)ReadByte() switch 349TypeCode.Array_0 => 0, 350TypeCode.Array_1 => 1, 351TypeCode.Array_2 => 2, 352TypeCode.Array_3 => 3,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (38)
171WriteByte((byte)TypeCode.Null); 196WriteByte((byte)TypeCode.Float8); 201WriteByte((byte)((bool)value ? TypeCode.Boolean_True : TypeCode.Boolean_False)); 205WriteByte((byte)TypeCode.Char); 210WriteByte((byte)TypeCode.UInt8); 215WriteByte((byte)TypeCode.Int16); 220WriteByte((byte)TypeCode.Int64); 225WriteByte((byte)TypeCode.Int8); 230WriteByte((byte)TypeCode.Float4); 235WriteByte((byte)TypeCode.UInt16); 244WriteByte((byte)TypeCode.UInt64); 254WriteByte((byte)TypeCode.Decimal); 259WriteByte((byte)TypeCode.DateTime); 328WriteByte((byte)TypeCode.Array_0); 331WriteByte((byte)TypeCode.Array_1); 334WriteByte((byte)TypeCode.Array_2); 337WriteByte((byte)TypeCode.Array_3); 340WriteByte((byte)TypeCode.Array); 366WriteByte((byte)((int)TypeCode.Int32_0 + v)); 370WriteByte((byte)TypeCode.Int32_1Byte); 375WriteByte((byte)TypeCode.Int32_2Bytes); 380WriteByte((byte)TypeCode.Int32); 389WriteByte((byte)((int)TypeCode.UInt32_0 + v)); 393WriteByte((byte)TypeCode.UInt32_1Byte); 398WriteByte((byte)TypeCode.UInt32_2Bytes); 403WriteByte((byte)TypeCode.UInt32); 446WriteByte((byte)TypeCode.Null); 455WriteByte((byte)TypeCode.StringRef_1Byte); 460WriteByte((byte)TypeCode.StringRef_2Bytes); 465WriteByte((byte)TypeCode.StringRef_4Bytes); 478WriteByte((byte)TypeCode.StringUtf8); 483WriteByte((byte)TypeCode.StringUtf16); 503WriteByte((byte)TypeCode.Null); 511WriteByte((byte)TypeCode.EncodingCodePage); 516WriteByte((byte)TypeCode.EncodingName); 522static TypeCode ToTypeCode(TextEncodingKind kind) 525return TypeCode.FirstWellKnownTextEncoding + (byte)(kind - EncodingExtensions.FirstTextEncodingKind);