当前位置: 首页>>代码示例>>C#>>正文


C# global.GetChars方法代码示例

本文整理汇总了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;
		}
开发者ID:apoorv-vijay-joshi,项目名称:FSE-2011-PDE,代码行数:43,代码来源:SerializationHelper.cs

示例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;
		}
开发者ID:Phidiax,项目名称:open-wssf-2015,代码行数:36,代码来源:SerializationHelper.cs


注:本文中的global.GetChars方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。