<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>C# &#8211; ChaBug安全</title>
	<atom:link href="/tags/c/feed" rel="self" type="application/rss+xml" />
	<link>/</link>
	<description>一个分享知识、结识伙伴、资源共享的博客</description>
	<lastBuildDate>Mon, 26 Mar 2018 09:55:59 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.5.5</generator>
	<item>
		<title>Unity中UGUI实现技能冷却</title>
		<link>/code/387.html</link>
		
		<dc:creator><![CDATA[Y4er]]></dc:creator>
		<pubDate>Mon, 26 Mar 2018 09:55:59 +0000</pubDate>
				<category><![CDATA[编程学习]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Unity]]></category>
		<category><![CDATA[代码]]></category>
		<guid isPermaLink="false">/?p=316</guid>

					<description><![CDATA[直接贴代码 using UnityEngine; using System.Collections; using UnityEngine.UI; public class Test...]]></description>
										<content:encoded><![CDATA[<p>直接贴<span class="wpcom_tag_link"><a href="/tags/%e4%bb%a3%e7%a0%81" title="代码" target="_blank">代码</a></span></p>
<pre><code>using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class TestFiled : MonoBehaviour
{
    private Image m_image;
    //冷却时间
    public float time=2;
    void Start ()
    {
        m_image = this.GetComponent ();
        //设置图片类型为filed
        m_image.type=Image.Type.Filled;
        //设置图片填充方法
        m_image.fillMethod=Image.FillMethod.Radial360;
        //设置初始填充位置
        m_image.fillOrigin=2;
        //填充比例
        m_image.fillAmount=0;
    }
    void Update ()
    {
        //如果填充比例小于1</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>C#中的String.Format方法</title>
		<link>/code/380.html</link>
		
		<dc:creator><![CDATA[Y4er]]></dc:creator>
		<pubDate>Tue, 20 Mar 2018 15:17:57 +0000</pubDate>
				<category><![CDATA[编程学习]]></category>
		<category><![CDATA[C#]]></category>
		<guid isPermaLink="false">/?p=289</guid>

					<description><![CDATA[一、定义String.Format是将指定的 String类型的数据中的每个格式项替换为相应对象的值的文本等效项。 如: （1） string p1 = &#34;Jackie&#038;...]]></description>
										<content:encoded><![CDATA[<p>一、定义<br />String.Format是将指定的 String类型的数据中的每个格式项替换为相应对象的值的文本等效项。 <br />如:</p>
<pre><code>（1）
string p1 = &quot;Jackie&quot;;
string p2 = &quot;Aillo&quot;;
Response.Write(String.Format(&quot;Hello {0}, I'm {1}&quot;, p1, p2));
（2）
Response.Write(String.Format(&quot;Hello {0}, I'm {1}&quot;, &quot;Jackie&quot;, &quot;Aillo&quot;));</code></pre>
<p>这二者的效果是一样的。都是将最后面的两项的值分别替换第一项的{0}和{1}。<br />输出的结果是：Hello Jackie, I&#8217;m Aillo<br />二、String.Format的多格式定义：</p>
<pre><code>  这里所谓的多格式是指一个格式项中可以定义1~3个格式参数，每种格式参数用分号（；）隔开。带2个和3个格式参数的格式项所对应的值必须是数值类型的，这样才能判断是否为负数、正数、零。</code></pre>
<p>带1个格式参数：</p>
<pre><code>//以科学计数法的格式输出
double p1 = 1000000;
Response.Write(String.Format(&quot;{0:E2}&quot;, p1));</code></pre>
<p>带2个格式参数：</p>
<pre><code>/*当格式项对应的值为非负数，则选择第一种格式；值为负数则选第二种格式*/
double p1 = 10000;
double p2 = -2420.50;
Response.Write(String.Format(&quot;{0:#,###0.00;#,###0.000;}&quot;, p1));
Response.Write(String.Format(&quot;{0:#,###0.00;#,###0.000;}&quot;, p2));</code></pre>
<p>带3个格式参数：</p>
<pre><code>/*当格式项对应的值为正数则选择第一张格式；
负数则为第二中格式；
值等于零则为第三种格式*/
1double p1 = 10000;
double p2 = -2420.50;
double p3 = 0.00;
Response.Write(String.Format(&quot;{0:#,###0.00;#,###0.000;#,###0.0000}&quot;, p1));
Response.Write(String.Format(&quot;{0:#,###0.00;#,###0.000;#,###0.0000}&quot;, p3));
Response.Write(String.Format(&quot;{0:#,###0.00;#,###0.000;#,###0.0000}&quot;, p2));</code></pre>
<p>补充：<br />{0:N2} 中的N3,f3表示格式化之后数据的类型以及小数的位数。如：N2表示带2个小数的数字；<br />与此类似：<br />N或者n  表示  数字<br />F或者f   表示  固定点<br />E或者e  表示  科学计数法<br />D或者d  表示  十进制数<br />X或者x  表示  十六进制<br />G或者g  表示  常规<br />C或者c  表示  货币</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
