本文整理汇总了C#中System.IO.StringWriter.WriteLine方法的典型用法代码示例。如果您正苦于以下问题:C# System.IO.StringWriter.WriteLine方法的具体用法?C# System.IO.StringWriter.WriteLine怎么用?C# System.IO.StringWriter.WriteLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.StringWriter
的用法示例。
在下文中一共展示了System.IO.StringWriter.WriteLine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: generate_visualizers
public void generate_visualizers()
{
var path = @"C:\code\diagnostics\src\FubuMVC.Diagnostics\Visualization\Visualizers\ConfigurationActions";
var types = typeof (FubuRequest).Assembly.GetExportedTypes()
.Where(x => x.IsConcreteTypeOf<IConfigurationAction>());
var fileSystem = new FileSystem();
types.Each(x =>
{
var writer = new StringWriter();
/*
<use master="" />
<viewdata model="FubuMVC.Diagnostics.Visualization.BehaviorNodeViewModel" />
*/
writer.WriteLine("<use master=\"\" />");
writer.WriteLine("<viewdata model=\"{0}\" />", x.FullName);
var file = path.AppendPath(x.Name + ".spark");
fileSystem.WriteStringToFile(file, writer.ToString());
});
}
示例2: ToString
public override string ToString()
{
System.IO.StringWriter s = new System.IO.StringWriter();
s.WriteLine("Circle with");
s.WriteLine(base.ToString());
s.WriteLine("Radius {0}", Radius);
return s.ToString();
}
示例3: Class1
static Class1()
{
// Create test writer object to hold expected output
System.IO.StringWriter expectedOut = new System.IO.StringWriter();
// Write expected output to string writer object
expectedOut.WriteLine("in finally");
expectedOut.WriteLine("done");
// Create and initialize test log object
testLog = new TestUtil.TestLog(expectedOut);
}
示例4: BisectionConsoleWriteLine
public static string BisectionConsoleWriteLine(theFunction1 fBisection, double x1, double x2, double eps)
{
System.IO.StringWriter s = new System.IO.StringWriter();
s.WriteLine("x1=({0}) x2=({1}) iterations=({2})", x1, x2, eps);
if (BisectionValid(fBisection, x1, x2) == true)
{
s.WriteLine("Bisection Valid = TRUE");
s.WriteLine("m=({0})", BisectionMethod(fBisection, x1, x2, eps));
}
else { s.WriteLine("Bisection Valid = FALSE"); }
return s.ToString();
}
示例5: Class1
static Class1()
{
// Create test writer object to hold expected output
System.IO.StringWriter expectedOut = new System.IO.StringWriter();
// Write expected output to string writer object
expectedOut.WriteLine("1234");
expectedOut.WriteLine("test2");
expectedOut.WriteLine("end outer catch test2");
expectedOut.WriteLine("1234");
// Create and initialize test log object
testLog = new TestUtil.TestLog(expectedOut);
}
示例6: Class1
static Class1()
{
// Create test writer object to hold expected output
System.IO.StringWriter expectedOut = new System.IO.StringWriter();
// Write expected output to string writer object
expectedOut.WriteLine("in Try catch");
expectedOut.WriteLine("in Try finally");
expectedOut.WriteLine("in Finally");
expectedOut.WriteLine("Caught an exception");
expectedOut.WriteLine("in Catch");
// Create and initialize test log object
testLog = new TestUtil.TestLog(expectedOut);
}
示例7: OrganizeExternalNamespaces
void OrganizeExternalNamespaces()
{
foreach (Assembly asm in Parameters.References)
{
try
{
NameResolutionService.OrganizeAssemblyTypes(asm);
}
catch (ReflectionTypeLoadException x)
{
System.IO.StringWriter loadErrors = new System.IO.StringWriter();
loadErrors.Write("'" + asm.FullName + "' - (" + GetLocation(asm) + "):");
loadErrors.WriteLine(x.Message);
foreach(Exception e in x.LoaderExceptions)
{
loadErrors.WriteLine(e.Message);
}
Errors.Add(
CompilerErrorFactory.FailedToLoadTypesFromAssembly(
loadErrors.ToString(), x));
}
catch (Exception x)
{
Errors.Add(
CompilerErrorFactory.FailedToLoadTypesFromAssembly(
"'" + asm.FullName + "' - (" + GetLocation(asm) + "): " + x.Message, x));
}
}
}
示例8: RegisterEnableRemoveButtonScript
private void RegisterEnableRemoveButtonScript()
{
Type t = this.Page.GetType();
string scriptName = "_kh_RegisterEnableRemoveButton";
if (!this.Page.ClientScript.IsClientScriptBlockRegistered(t, scriptName))
{
System.IO.StringWriter sw1 = new System.IO.StringWriter();
sw1.WriteLine("function EnableRemoveButton(removeButtonId, hfId) ");
sw1.WriteLine("{ ");
sw1.WriteLine(" var hf = document.getElementById(hfId); ");
sw1.WriteLine(" if (hf); ");
sw1.WriteLine(" document.getElementById(removeButtonId).disabled = (hf.value == '||' || hf.value == '|');");
sw1.WriteLine("} ");
this.Page.ClientScript.RegisterClientScriptBlock(t, scriptName, sw1.ToString(), true);
}
}
示例9: ToString
public string ToString(bool verbose)
{
System.IO.StringWriter writer = new System.IO.StringWriter();
foreach (CompilerError error in InnerList)
{
writer.WriteLine(error.ToString(verbose));
}
return writer.ToString();
}
示例10: GenerateHexDump
public static string GenerateHexDump(byte[] data) {
if (data == null || data.Length == 0)
return "";
int size = data.Length;
//ByteBuffer buffer = new ByteBuffer(data);
System.IO.MemoryStream buffer = new System.IO.MemoryStream(data);
//long remaining = (buffer.Length - buffer.Position);
string ascii = "";
//StringBuilder sb = new StringBuilder((buffer.Remaining * 3) - 1);
StringBuilder sb = new StringBuilder(((int)(buffer.Length - buffer.Position) * 3) - 1);
System.IO.StringWriter writer = new System.IO.StringWriter(sb);
int lineCount = 0;
for (int i = 0; i < size; i++) {
int val = buffer.ReadByte() & 0xFF;
writer.Write((char)highDigits[val]);
writer.Write((char)lowDigits[val]);
writer.Write(" ");
ascii += GetAsciiEquivalent(val) + " ";
lineCount++;
if (i == 0)
continue;
if ((i + 1) % 8 == 0)
writer.Write(" ");
if ((i + 1) % 16 == 0) {
writer.Write(" ");
writer.Write(ascii);
writer.WriteLine();
ascii = "";
lineCount = 0;
} else if (i == size - 1) {///HALF-ASSED ATTEMPT TO GET THE LAST LINE OF ASCII TO LINE UP CORRECTLY
//while(lineCount < 84) {
// writer.Write(" ");
// lineCount++;
//}
for (int y = lineCount; y < 25; y++) {
writer.Write(" ");
}
writer.Write(ascii);
writer.WriteLine();
}
}
return sb.ToString();
}
示例11: ReadFromFileToString
static string ReadFromFileToString(string aTextFile)
{
System.IO.StreamReader InputFile = new System.IO.StreamReader(aTextFile);
System.IO.StringWriter s = new System.IO.StringWriter();
while (!InputFile.EndOfStream)
{
s.WriteLine(InputFile.ReadLine());
}
return s.ToString();
}
示例12: StringReader
static string StringReader(string Input)
{
System.IO.StringWriter s = new System.IO.StringWriter();
System.IO.StreamReader theFile = new System.IO.StreamReader(Input);
while (theFile.EndOfStream != true)
{
s.WriteLine(theFile.ReadLine());
}
return s.ToString();
}
示例13: Serialize
public static string Serialize(System.Collections.Generic.Dictionary<string, object> ht)
{
System.IO.StringWriter wr = new System.IO.StringWriter();
wr.Write("{");
//this should guarantee english decimal separators. If not, try en-us.
//System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
//System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
bool fFirst = true;
foreach (var kvp in ht)
{
if (!fFirst)
{
wr.WriteLine(",");
}
else
{
wr.WriteLine();
fFirst = false;
}
wr.Write(string.Format("\t\"{0:S}\": ", kvp.Key));
if (kvp.Value is double)
wr.Write(((double)kvp.Value).ToString());
else if (kvp.Value is int)
wr.Write(((int)kvp.Value).ToString());
else if (kvp.Value is long)
wr.Write(((long)kvp.Value).ToString());
else if (kvp.Value is DateTime)
wr.Write(UnixTicks(((DateTime)kvp.Value)).ToString());
else
wr.Write(string.Format("\"{0:S}\"", kvp.Value.ToString()));
}
wr.WriteLine();
wr.WriteLine("}");
wr.Flush();
return wr.ToString();
}
示例14: FormatInnerException
public static string FormatInnerException(Exception exception)
{
var writer = new System.IO.StringWriter();
var lastStacktrace = exception.StackTrace;
var tabCount = 0;
var currentException = exception;
while(currentException != null)
{
writer.WriteLine("{0}{1}", new string('\t', tabCount), currentException.Message);
lastStacktrace = currentException.StackTrace;
tabCount++;
currentException = currentException.InnerException;
}
writer.WriteLine(lastStacktrace);
return writer.ToString();
}
示例15: Class1
static Class1()
{
// Create test writer object to hold expected output
System.IO.StringWriter expectedOut = new System.IO.StringWriter();
// Write expected output to string writer object
System.Exception exp = new System.Exception();
expectedOut.WriteLine("In f1");
expectedOut.WriteLine("In f2");
expectedOut.WriteLine("In f2's catch " + exp.Message);
expectedOut.WriteLine("In f1's catch " + exp.Message);
expectedOut.WriteLine("In main's catch1 " + exp.Message);
expectedOut.WriteLine("In f1");
expectedOut.WriteLine("In f2");
expectedOut.WriteLine("In f2's catch " + exp.Message);
expectedOut.WriteLine("In f1's catch " + exp.Message);
expectedOut.WriteLine("In main's catch2 " + exp.Message);
// Create and initialize test log object
testLog = new TestUtil.TestLog(expectedOut);
}