本文整理汇总了C#中global.GetChars方法的典型用法代码示例。如果您正苦于以下问题:C# global.GetChars方法的具体用法?C# global.GetChars怎么用?C# global.GetChars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类global
的用法示例。
在下文中一共展示了global.GetChars方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSerializedModelStringVarianten
/// <summary>
/// Return the model in XML format
/// </summary>
/// <param name="modelRoot">Root instance to be saved.</param>
/// <param name="encoding">Encoding to use when saving the root instance.</param>
/// <param name="serializationMode">Serialization Mode.</param>
/// <returns>Model in XML form</returns>
public virtual string GetSerializedModelStringVarianten(global::Tum.VModellXT.Varianten modelRoot, global::System.Text.Encoding encoding, DslEditorModeling.SerializationMode serializationMode)
{
string result = string.Empty;
if (modelRoot == null)
{
return result;
}
//DslEditorModeling::DomainModelStore dStore = (DslEditorModeling::DomainModelStore)modelRoot.Store;
//if( dStore == null)
// throw new global::System.ArgumentNullException("dStore");
//dStore.WaitForWritingLockRelease();
DslModeling::SerializationResult serializationResult = new DslModeling::SerializationResult();
using (global::System.IO.MemoryStream modelFileContent = this.InternalSaveModelVarianten(serializationResult, modelRoot, string.Empty, encoding, false, serializationMode))
{
if (!serializationResult.Failed && modelFileContent != null)
{
char[] chars = encoding.GetChars(modelFileContent.GetBuffer());
// search the open angle bracket and trim off the Byte Of Mark.
result = new string( chars);
int indexPos = result.IndexOf('<');
if (indexPos > 0)
{
// strip off the leading Byte Of Mark.
result = result.Substring(indexPos);
}
// trim off trailing 0s.
result = result.TrimEnd( '\0');
}
}
return result;
}
示例2: GetSerializedModelString
/// <summary>
/// Return the model in XML format
/// </summary>
/// <param name="modelRoot">Root instance to be saved.</param>
/// <param name="encoding">Encoding to use when saving the root instance.</param>
/// <returns>Model in XML form</returns>
public virtual string GetSerializedModelString(global::Microsoft.Practices.ServiceFactory.HostDesigner.HostDesignerModel modelRoot, global::System.Text.Encoding encoding)
{
string result = string.Empty;
if (modelRoot == null)
{
return result;
}
DslModeling::SerializationResult serializationResult = new DslModeling::SerializationResult();
using (global::System.IO.MemoryStream modelFileContent = this.InternalSaveModel(serializationResult, modelRoot, string.Empty, encoding, false))
{
if (!serializationResult.Failed && modelFileContent != null)
{
char[] chars = encoding.GetChars(modelFileContent.GetBuffer());
// search the open angle bracket and trim off the Byte Of Mark.
result = new string( chars);
int indexPos = result.IndexOf('<');
if (indexPos > 0)
{
// strip off the leading Byte Of Mark.
result = result.Substring(indexPos);
}
// trim off trailing 0s.
result = result.TrimEnd( '\0');
}
}
return result;
}