PK ‘}UL 01-ForEachExplicitCast/PK ƒHUJTò¶h½ ½ ! 01-ForEachExplicitCast/App.config
PK ƒHUJ`ìjîŠ
Š
1 01-ForEachExplicitCast/ForEachExplicitCast.csproj
Debug
AnyCPU
{57EBEE27-CA8B-430F-9D2B-64C7ACB1CCDC}
Exe
Properties
ForEachExplicitCast
ForEachExplicitCast
v4.5.2
512
true
AnyCPU
true
full
false
bin\Debug\
DEBUG;TRACE
prompt
4
AnyCPU
pdbonly
true
bin\Release\
TRACE
prompt
4
PK „HUJn#$¥ì ì . 01-ForEachExplicitCast/ForEachExplicitCast.sln
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ForEachExplicitCast", "ForEachExplicitCast.csproj", "{57EBEE27-CA8B-430F-9D2B-64C7ACB1CCDC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{57EBEE27-CA8B-430F-9D2B-64C7ACB1CCDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{57EBEE27-CA8B-430F-9D2B-64C7ACB1CCDC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{57EBEE27-CA8B-430F-9D2B-64C7ACB1CCDC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{57EBEE27-CA8B-430F-9D2B-64C7ACB1CCDC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
PK OIUJ®|ŽÛ Û ! 01-ForEachExplicitCast/Program.csusing System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForEachExplicitCast {
class Program {
static void Main(string[] args) {
List ints = new List { 1, 2, 3, 256, 257 };
foreach (byte b in ints) {
Console.Write($"{b} ");
}
Console.WriteLine(); Console.WriteLine();
// Error CS0030: Cannot convert type 'int' to 'string'
// foreach (string s in ints) {
// Console.Write($"{s} ");
// }
//
Console.Write("Press ENTER to continue ...");
Console.ReadLine();
Console.WriteLine();
//
List As = new List { new A { Value = 10 }, new A { Value = 20 } };
foreach (string s in As) {
Console.Write($"{s} ");
}
Console.WriteLine(); Console.WriteLine();
}
}
class A {
public int Value { get; set; }
public static explicit operator string(A a) {
return $"A[Value={a.Value}]";
}
}
}
PK ‘}UL " 01-ForEachExplicitCast/Properties/PK ƒHUJÑ3Çqª ª 1 01-ForEachExplicitCast/Properties/AssemblyInfo.csusing System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ForEachExplicitCast")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ForEachExplicitCast")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("57ebee27-ca8b-430f-9d2b-64c7acb1ccdc")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
PK ‘}UL 01-ForEachExplicitCast/PK ƒHUJTò¶h½ ½ ! 5 01-ForEachExplicitCast/App.configPK ƒHUJ`ìjîŠ
Š
1 1 01-ForEachExplicitCast/ForEachExplicitCast.csprojPK „HUJn#$¥ì ì .
01-ForEachExplicitCast/ForEachExplicitCast.slnPK OIUJ®|ŽÛ Û ! B 01-ForEachExplicitCast/Program.csPK ‘}UL " \ 01-ForEachExplicitCast/Properties/PK ƒHUJÑ3Çqª ª 1 œ 01-ForEachExplicitCast/Properties/AssemblyInfo.csPK M •