Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
huruiyi committed Jan 6, 2024
1 parent 0d0529e commit 65d9fde
Show file tree
Hide file tree
Showing 69 changed files with 335 additions and 400 deletions.
4 changes: 2 additions & 2 deletions dotnet-samples/Basic/ConApp/AopDemo1/MyMessageSink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ public IMessage SyncProcessMessage(IMessage msg)
MethodInfo methodInfo = returnMessage.MethodBase as MethodInfo;

int argCount = returnMessage.ArgCount;
Console.WriteLine("方法的输入参数个数:{0}", argCount);
Console.WriteLine(@"方法的输入参数个数:{0}", argCount);
for (int i = 0; i < argCount; i++)
{
var obj = returnMessage.Args[i];
Console.WriteLine("方法的第{0}参数:名:{1},值:{2}", i + 1, methodInfo.GetParameters()[i].Name, returnMessage.Args[i]);
}
Console.WriteLine("方法的返回值:{0}", returnMessage.ReturnValue);
Console.WriteLine(@"方法的返回值:{0}", returnMessage.ReturnValue);

string returnType = methodInfo.ReturnType.Name;
ParameterInfo[] ps = methodInfo.GetParameters();
Expand Down
1 change: 1 addition & 0 deletions dotnet-samples/Basic/ConApp/ConApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@
<Compile Include="EventSample\EventDemo6\Heater.cs" />
<Compile Include="EventSample\EventDemo6\Test.cs" />
<Compile Include="Model\EnitityMappingAttribute.cs" />
<Compile Include="Model\LargeObject.cs" />
<Compile Include="Model\Member.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
Expand Down
6 changes: 3 additions & 3 deletions dotnet-samples/Basic/ConApp/DelegateDemos/DelegateDemo1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ private static void Print(Sayhello sayHello)

private static void ChineseSayHello(object name)
{
Console.WriteLine("{0}:中国", name);
Console.WriteLine(@"{0}:中国", name);
}

private static void EnglishSayHello(object name)
{
Console.WriteLine("{0}:英国", name);
Console.WriteLine(@"{0}:英国", name);
}

private static void JapaneseSayHello(object name)
{
Console.WriteLine("{0}:日本", name);
Console.WriteLine(@"{0}:日本", name);
}

private static void PrintHelloWord(Func<string, object> sayHello)
Expand Down
4 changes: 2 additions & 2 deletions dotnet-samples/Basic/ConApp/DelegateDemos/DelegateDemo4.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ public void TestMethod(int input)
int j = 0;
Del1 = () => { j = 10; return j > input; };
Del2 = x => x == j;
Console.WriteLine("j = {0}", j);
Console.WriteLine(@"j = {0}", j);
bool boolResult = Del1();
Console.WriteLine("j = {0}. b = {1}", j, boolResult);
Console.WriteLine(@"j = {0}. b = {1}", j, boolResult);
}

public static string MulMethod(int i)
Expand Down
4 changes: 2 additions & 2 deletions dotnet-samples/Basic/ConApp/DelegateDemos/DelegateDemo8.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void Invoke()
DelMath delLambda2 = (i, i1) => i + i1;
delLambda2(3, 2);

Console.WriteLine(" 主线程是:{0}", Thread.CurrentThread.ManagedThreadId);
Console.WriteLine(@" 主线程是:{0}", Thread.CurrentThread.ManagedThreadId);

DelMath myDel = new DelMath(AddStatic);

Expand All @@ -78,7 +78,7 @@ public void Invoke()
//主线程干其他事
}
int addResult = myDel.EndInvoke(delResult);
Console.WriteLine("主线程获得结果是:{0}", addResult);
Console.WriteLine(@"主线程获得结果是:{0}", addResult);

myDelMath1 mdm = delegate (int a, int b, int c)
{
Expand Down
2 changes: 1 addition & 1 deletion dotnet-samples/Basic/ConApp/DelegateDemos/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static void Run()

foreach (KeyValuePair<int, Type> keyValuePair in typeMap)
{
Console.WriteLine("{0}:{1}", keyValuePair.Key.ToString().PadLeft(2, '0'), keyValuePair.Value.Name);
Console.WriteLine(@"{0}:{1}", keyValuePair.Key.ToString().PadLeft(2, '0'), keyValuePair.Value.Name);
}
Console.WriteLine("请输入编号执行");
string strNum = Console.ReadLine();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ public class NewspaperReader
public void SubscribeNewspaper(NewspaperOffice office)
{
office.OnNewspaperPrint += Read;
Console.WriteLine("{0}订阅了{1}报纸", Name, office.Name);
Console.WriteLine(@"{0}订阅了{1}报纸", Name, office.Name);
}

public void UnSubscribeNewspaper(NewspaperOffice office)
{
office.OnNewspaperPrint -= Read;
Console.WriteLine("{0},退订了{1}报纸", Name, office.Name);
Console.WriteLine(@"{0},退订了{1}报纸", Name, office.Name);
}

public void Read(string content)
{
Console.WriteLine("{0}正在读报纸,内容为:{1}", Name, content);
Console.WriteLine(@"{0}正在读报纸,内容为:{1}", Name, content);
}

public string Name { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ public class NewspaperReader
public void SubscribeNewspaper(NewspaperOffice office)
{
office.OnNewspaperPrint += Read;
Console.WriteLine("{0}订阅了{1}报纸", Name, office.Name);
Console.WriteLine(@"{0}订阅了{1}报纸", Name, office.Name);
}

public void UnSubscribeNewspaper(NewspaperOffice office)
{
office.OnNewspaperPrint -= Read;
Console.WriteLine("{0},退订了{1}报纸", Name, office.Name);
Console.WriteLine(@"{0},退订了{1}报纸", Name, office.Name);
}

public void Read(object sender, NewspaperEventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion dotnet-samples/Basic/ConApp/EventSample/EventDemo4/Cat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class Cat
{
public void Sleep(string place)
{
Console.WriteLine("猫在{0}地方睡觉", place);
Console.WriteLine(@"猫在{0}地方睡觉", place);
}

public void Shout()
Expand Down
4 changes: 2 additions & 2 deletions dotnet-samples/Basic/ConApp/EventSample/EventDemo4/Master.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ public class Master
{
public void Sleep(string place)
{
Console.WriteLine("主人正在{0}睡觉!", place);
Console.WriteLine(@"主人正在{0}睡觉!", place);
}

public void Wakeup(string content)
{
Console.WriteLine("猫叫了声:{0},主人惊醒了!", content);
Console.WriteLine(@"猫叫了声:{0},主人惊醒了!", content);
}
}
}
4 changes: 2 additions & 2 deletions dotnet-samples/Basic/ConApp/EventSample/EventDemo4/Mouse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ public class Mouse
{
public void CatlikeEat(string place, string food)
{
Console.WriteLine("老鼠正在{0}偷吃{1}", place, food);
Console.WriteLine(@"老鼠正在{0}偷吃{1}", place, food);
}

public void RunAway(string content)
{
Console.WriteLine("猫叫了声:{0},老鼠被吓跑了", content);
Console.WriteLine(@"猫叫了声:{0},老鼠被吓跑了", content);
}
}
}
2 changes: 1 addition & 1 deletion dotnet-samples/Basic/ConApp/EventSample/EventDemo5/Cat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public void OnMasterSpeak(string content)
{
if (content == "Bye Bye")
{
Console.WriteLine("{0}猫叫了声:喵喵", Name);
Console.WriteLine(@"{0}猫叫了声:喵喵", Name);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion dotnet-samples/Basic/ConApp/EventSample/EventDemo5/Dog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public void OnMasterSpeak(string content)
{
if (content == "Bye Bye")
{
Console.WriteLine("{0}狗叫了声:汪汪", Name);
Console.WriteLine(@"{0}狗叫了声:汪汪", Name);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class Human

public void Speak(string content)
{
Console.WriteLine("{0}说了句:{1}", Name, content);
Console.WriteLine(@"{0}说了句:{1}", Name, content);
if (OnSpeak != null)
{
OnSpeak(content);
Expand Down
4 changes: 2 additions & 2 deletions dotnet-samples/Basic/ConApp/EventSample/EventDemo6/Heater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ public void Begin()
heatTime = 5;
heatThread = new Thread(new ThreadStart(Heat));
heatThread.Start();
Console.WriteLine("加热器已经开启", heatTime);
Console.WriteLine(@"加热器已经开启", heatTime);

}
private int heatTime;
private void Heat()
{
while (true)
{
Console.WriteLine("加热还需{0}秒", heatTime);
Console.WriteLine(@"加热还需{0}秒", heatTime);

if (heatTime == 0)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace DotNet
namespace ConApp.Model
{

class LargeObject
public class LargeObject
{
int initBy = 0;
public int InitializedBy { get { return initBy; } }

public LargeObject()
{
initBy = Thread.CurrentThread.ManagedThreadId;
Console.WriteLine("LargeObject was created on thread id {0}.", initBy);
Console.WriteLine(@"LargeObject was created on thread id {0}.", initBy);
}
public long[] Data = new long[100000000];
}
}
}
2 changes: 1 addition & 1 deletion dotnet-samples/Basic/ConApp/Model/ReflectionClass2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void Set(double a, double b)

public void Show()
{
Console.WriteLine("x:{0},y:{1}", x, y);
Console.WriteLine(@"x:{0},y:{1}", x, y);
}
}
}
2 changes: 1 addition & 1 deletion dotnet-samples/Basic/ConApp/Model/ReflectionClass3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void Set(double a, double b)

public void Show()
{
Console.WriteLine("x:{0},y:{1}", x, y);
Console.WriteLine(@"x:{0},y:{1}", x, y);
}
}
}
2 changes: 1 addition & 1 deletion dotnet-samples/Basic/ConApp/Model/ReflectionClass4.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void Set(double a, double b)

public void Show()
{
Console.WriteLine("x:{0},y:{1}", x, y);
Console.WriteLine(@"x:{0},y:{1}", x, y);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class UseDelegateAndStateForAsyncCallback

private static void UpdateUserInterface()
{
Console.WriteLine("{0} requests remaining.", requestCounter);
Console.WriteLine(@"{0} requests remaining.", requestCounter);
}

public static void Main1()
Expand Down Expand Up @@ -66,7 +66,7 @@ public static void Main1()
{
if (r.ExceptionObject != null)
{
Console.WriteLine("Request for host {0} returned the following error: {1}.", r.HostName, r.ExceptionObject.Message);
Console.WriteLine(@"Request for host {0} returned the following error: {1}.", r.HostName, r.ExceptionObject.Message);
}
else
{
Expand All @@ -75,18 +75,18 @@ public static void Main1()
IPAddress[] addresses = h.AddressList;
if (aliases.Length > 0)
{
Console.WriteLine("Aliases for {0}", r.HostName);
Console.WriteLine(@"Aliases for {0}", r.HostName);
foreach (string t in aliases)
{
Console.WriteLine("{0}", t);
Console.WriteLine(@"{0}", t);
}
}
if (addresses.Length > 0)
{
Console.WriteLine("Addresses for {0}", r.HostName);
Console.WriteLine(@"Addresses for {0}", r.HostName);
foreach (IPAddress t in addresses)
{
Console.WriteLine("{0}", t.ToString());
Console.WriteLine(@"{0}", t.ToString());
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions dotnet-samples/Basic/ConApp/OtherDemo/_4AsyncCallback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,35 +41,35 @@ private static void Main04(string[] args)
string message = data as string;
if (message != null)
{
Console.WriteLine("Request for {0} returned message: {1}", HostNames[i], message);
Console.WriteLine(@"Request for {0} returned message: {1}", HostNames[i], message);
continue;
}
IPHostEntry h = (IPHostEntry)data;
string[] aliases = h.Aliases;
if (aliases.Length > 0)
{
Console.WriteLine("Aliases for {0}", HostNames[i]);
Console.WriteLine(@"Aliases for {0}", HostNames[i]);
foreach (string t in aliases)
{
Console.WriteLine("{0}", t);
Console.WriteLine(@"{0}", t);
}
}

IPAddress[] addresses = h.AddressList;
if (addresses.Length > 0)
{
Console.WriteLine("Addresses for {0}", HostNames[i]);
Console.WriteLine(@"Addresses for {0}", HostNames[i]);
foreach (IPAddress t in addresses)
{
Console.WriteLine("{0}", t);
Console.WriteLine(@"{0}", t);
}
}
}
}

private static void UpdateUserInterface()
{
Console.WriteLine("{0} requests remaining.", _requestCounter);
Console.WriteLine(@"{0} requests remaining.", _requestCounter);
}

private static void ProcessDnsInformation(IAsyncResult result)
Expand Down
2 changes: 1 addition & 1 deletion dotnet-samples/Basic/ConApp/OtherDemo/_5IOOperate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private static void Main5(string[] args)
new FileStream("Test#@@#.dat", FileMode.Create,
FileAccess.ReadWrite, FileShare.None, 4096, true);

Console.WriteLine("fStream was {0}opened asynchronously.",
Console.WriteLine(@"fStream was {0}opened asynchronously.",
fStream.IsAsync ? "" : "not ");

// Asynchronously write to the file. new State(fStream, writeArray, manualEvent)
Expand Down
Loading

0 comments on commit 65d9fde

Please sign in to comment.