<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>C Board - C# Programming</title>
		<link>http://cboard.cprogramming.com/</link>
		<description>Questions specific to C# Programming</description>
		<language>en</language>
		<lastBuildDate>Wed, 16 May 2012 22:20:41 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://cboard.cprogramming.com/images/misc/rss.png</url>
			<title>C Board - C# Programming</title>
			<link>http://cboard.cprogramming.com/</link>
		</image>
		<item>
			<title>String Comparison Issues</title>
			<link>http://cboard.cprogramming.com/csharp-programming/148575-string-comparison-issues.html</link>
			<pubDate>Wed, 16 May 2012 02:35:32 GMT</pubDate>
			<description><![CDATA[If I have the following test code: 
 
 
Code: 
--------- 
String content = "This is a test"; 
String str = "This"; 
String lookFor = content.Substring(0, 5); // "This" 
Boolean found = false;]]></description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->If I have the following test code:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">String content = &quot;This is a test&quot;;<br />
String str = &quot;This&quot;;<br />
String lookFor = content.Substring(0, 5); // &quot;This&quot;<br />
Boolean found = false;<br />
<br />
// &quot;found&quot; should equal true, BUT IT'S NOT!!!&nbsp; Why??<br />
if (str == lookFor)<br />
&nbsp; &nbsp; &nbsp; &nbsp; found = true;<br />
<br />
// &quot;found&quot; should equal true, BUT IT'S NOT!!!&nbsp; Why??<br />
if (str.Equals(lookFor))<br />
&nbsp; &nbsp; &nbsp; &nbsp; found = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
// &quot;found&quot; should equal true, BUT IT'S NOT!!!&nbsp; Why??<br />
switch (lookFor)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; case &quot;This&quot;:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; found = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
}</code><hr />
</div>In all three examples, &quot;found&quot; should be true, however, it never happens.<br />
<br />
Where am I going wrong?<br />
<br />
Thanks.<!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/csharp-programming/">C# Programming</category>
			<dc:creator>xwielder</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/csharp-programming/148575-string-comparison-issues.html</guid>
		</item>
		<item>
			<title>Getting the URL</title>
			<link>http://cboard.cprogramming.com/csharp-programming/148475-getting-url.html</link>
			<pubDate>Fri, 11 May 2012 16:29:28 GMT</pubDate>
			<description>Hi! 
 
Is there a way to get the URL when the user opens a web page with a common web browser? 
 
Thanks.</description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->Hi!<br />
<br />
Is there a way to get the URL when the user opens a web page with a common web browser?<br />
<br />
Thanks.<!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/csharp-programming/">C# Programming</category>
			<dc:creator>geek@02</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/csharp-programming/148475-getting-url.html</guid>
		</item>
		<item>
			<title>Function from .cs file calling function from a different .cs file</title>
			<link>http://cboard.cprogramming.com/csharp-programming/148449-function-cs-file-calling-function-different-cs-file.html</link>
			<pubDate>Thu, 10 May 2012 22:25:41 GMT</pubDate>
			<description>What I am trying to do (in brief terms): 
	I have a function in a .cs file (A) that needs to access a function in a different .cs file (B).  Based on certain calculations, (B) will alter (A) variables. 
	 
The problem: 
	I keep getting the following WARNINGs: 
		warning CS0649: Field...</description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->What I am trying to do (in brief terms):<br />
	I have a function in a .cs file (A) that needs to access a function in a different .cs file (B).  Based on certain calculations, (B) will alter (A) variables.<br />
	<br />
The problem:<br />
	I keep getting the following WARNINGs:<br />
		warning CS0649: Field 'programX.MainWindow.tCodes' is never assigned to, and will always have its default value null<br />
		warning CS0649: Field 'programX.TriggerCodes.function_MainWindow' is never assigned to, and will always have its default value null<br />
<br />
Possibly needed details:<br />
	OS:  Windows 7 64-bit<br />
	Compiler:  MS Visual Studio 2010 Ultimate<br />
	Language:  C# (WPF)<br />
	Framework: 4.0<br />
	<br />
And finally, a sample piece of code:<br />
<br />
In &quot;MainWindow.xaml.cs&quot;:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">namespace programX<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; public partial class MainWindow : Window<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public TriggerCodes tCodes;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public MainWindow()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; InitializeComponent();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; protected internal void doSomething()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (tCodes.triggerCodeFound(&quot;Hello World&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;Didn't find it&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void sayHello(string message)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; StringBuilder msg = new StringBuilder();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; msg.Append(&quot;Hello &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; msg.Append(message);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // *should* write &quot;Hello Silly Person!&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.WriteLine(msg.ToString());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}</code><hr />
</div><br />
In &quot;TriggerCodes.cs&quot;:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">namespace programX<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; public partial class TriggerCodes<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public MainWindow function_MainWindow;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public bool triggerCodeFound(String theData)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ((theData.IndexOf(&quot;World&quot;) &gt; (-1)))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.function_MainWindow.sayHello(&quot;Silly Person!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return (true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return (false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}</code><hr />
</div><br />
I am a C/C++ coder by trade, and just learning C#.  In C/C++, this is a rather simple concept for me to grasp, however, C# is kicking my arse and laughing all the way.<br />
<br />
Any help to avenge this temporary nemesis would be awesome.<br />
<br />
Thanks!<!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/csharp-programming/">C# Programming</category>
			<dc:creator>xwielder</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/csharp-programming/148449-function-cs-file-calling-function-different-cs-file.html</guid>
		</item>
		<item>
			<title>How can you start an application and automatically pass input to that application?</title>
			<link>http://cboard.cprogramming.com/csharp-programming/148428-how-can-you-start-application-automatically-pass-input-application.html</link>
			<pubDate>Thu, 10 May 2012 00:00:31 GMT</pubDate>
			<description><![CDATA[I want to create an application that starts an application and passes input to that application. I know how to start a process using the classes in System.Diagnostics, but I don't know how to pass data to the process. 
 
For example, and this is just an example, I would like to be able to...]]></description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->I want to create an application that starts an application and passes input to that application. I know how to start a process using the classes in System.Diagnostics, but I don't know how to pass data to the process.<br />
<br />
For example, and this is just an example, I would like to be able to automatically start an application that requires a username and password and automatically enter the username and password. Of course, that might open the door to security vulnerabilities, but that's not the point of the exercise.<br />
<br />
Can someone tell me how to implement the functionality I described?<br />
<br />
Is there a general way to go about doing this or does it depend entirely on the idiosyncrasies of the application in question?<!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/csharp-programming/">C# Programming</category>
			<dc:creator>IComparer</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/csharp-programming/148428-how-can-you-start-application-automatically-pass-input-application.html</guid>
		</item>
		<item>
			<title>why is there an exception when I call the ReadXml() method on a DataTable object?</title>
			<link>http://cboard.cprogramming.com/csharp-programming/148399-why-there-exception-when-i-call-readxml-method-datatable-object.html</link>
			<pubDate>Wed, 09 May 2012 02:14:39 GMT</pubDate>
			<description>I grabbed some data from a computer in the local network and placed it inside an ADO.NET DataTable and saved it to an Xml file in the local computer by calling the XmlWrite() method on the object and specifying XmlWriteMode.WriteSchema as the second argument. 
 
The Xml file was saved successfully,...</description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->I grabbed some data from a computer in the local network and placed it inside an ADO.NET DataTable and saved it to an Xml file in the local computer by calling the XmlWrite() method on the object and specifying XmlWriteMode.WriteSchema as the second argument.<br />
<br />
The Xml file was saved successfully, but when I later tried to open the same Xml file using the XmlRead() method, I kept getting an exception indicating that the data could not be read, apparently because the format of the data was not recognizable, or something along those lines.<br />
<br />
I reviewed the Xml file and didn't find any weird unicode characters in there. I also tried to write the Xml file by passing a FileStream object to the XmlWrite method and specifying the Encoding but that didn't solve the problem when i later tried to have the DataTable read the Xml file.<br />
<br />
Could this problem be related to the fact that the data that was loaded onto the first DataTable came from a spreadsheet file sitting on a computer running a 32 bit operating system, but when I tried to read the Xml file (after I saved it on the local computer via XmlWrite()) the data had been somehow made illegible by the fact that the local computer is running windows 7 64 bit?<br />
<br />
Someone mentioned something about a byte mark or something like that. Does anyone have a clue?<!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/csharp-programming/">C# Programming</category>
			<dc:creator>IComparer</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/csharp-programming/148399-why-there-exception-when-i-call-readxml-method-datatable-object.html</guid>
		</item>
		<item>
			<title>Getting the text contained in an external application</title>
			<link>http://cboard.cprogramming.com/csharp-programming/148393-getting-text-contained-external-application.html</link>
			<pubDate>Tue, 08 May 2012 16:43:30 GMT</pubDate>
			<description><![CDATA[Hi! 
 
i'm iterating through the system processes an when i find a process that belongs to a text oriented application, i want to read that text inside the external app. For example, when i get the process to an instance of notepad, i want to get the text contained inside notepad. i've tried to do...]]></description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->Hi!<br />
<br />
i'm iterating through the system processes an when i find a process that belongs to a text oriented application, i want to read that text inside the external app. For example, when i get the process to an instance of notepad, i want to get the text contained inside notepad. i've tried to do it using Process.MainWindowHandle pointer, but with no success. How to do it?<br />
(This is for an &quot;nanny&quot; app i'm writing, which need access to text in external applications so that i can detect any unappropriated words)<br />
<br />
Thanks.<!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/csharp-programming/">C# Programming</category>
			<dc:creator>geek@02</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/csharp-programming/148393-getting-text-contained-external-application.html</guid>
		</item>
		<item>
			<title>Speech to text</title>
			<link>http://cboard.cprogramming.com/csharp-programming/148284-speech-text.html</link>
			<pubDate>Thu, 03 May 2012 16:12:43 GMT</pubDate>
			<description><![CDATA[Hi! 
 
i need implement speech-to-text functionality. Have never tried this before. What's the easiest way to do this? Are there any libs that i can use for this? 
 
Thanks]]></description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->Hi!<br />
<br />
i need implement speech-to-text functionality. Have never tried this before. What's the easiest way to do this? Are there any libs that i can use for this?<br />
<br />
Thanks<!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/csharp-programming/">C# Programming</category>
			<dc:creator>geek@02</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/csharp-programming/148284-speech-text.html</guid>
		</item>
		<item>
			<title>String.Compare question</title>
			<link>http://cboard.cprogramming.com/csharp-programming/148283-string-compare-question.html</link>
			<pubDate>Thu, 03 May 2012 15:11:21 GMT</pubDate>
			<description><![CDATA[Hi! 
 
 
Code: 
--------- 
i = String.Compare(strActor, 0, comboBoxFilterActors.Text, 0, comboBoxFilterActors.Text.Length, true); 
--------- 
strActor contains a bunch of actor names (e.g. "Franka Potente, Tom Tykwer, Moritz Bleibtreu,"). comboBoxFilterActors.Text contains a single actor name to...]]></description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->Hi!<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">i = String.Compare(strActor, 0, comboBoxFilterActors.Text, 0, comboBoxFilterActors.Text.Length, true);</code><hr />
</div>strActor contains a bunch of actor names (e.g. &quot;<font color="#000">Franka Potente</font>, <font color="#000">Tom Tykwer</font>, <font color="#000">Moritz Bleibtreu</font>,&quot;). comboBoxFilterActors.Text contains a single actor name to search through strActor. Now because i've input comboBoxFilterActors.Text.Length as the 6th parameter, the compare method searches only through comboBoxFilterActors.Text variable length in strActor. But i wanna search through whole strActor. How to do that?<br />
<br />
Thanks a lot.<!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/csharp-programming/">C# Programming</category>
			<dc:creator>geek@02</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/csharp-programming/148283-string-compare-question.html</guid>
		</item>
		<item>
			<title>XNA code error Value cannot be null.</title>
			<link>http://cboard.cprogramming.com/csharp-programming/148240-xna-code-error-value-cannot-null.html</link>
			<pubDate>Tue, 01 May 2012 21:08:07 GMT</pubDate>
			<description>if (animations.ContainsKey(currentAnimation)) 
 
But it stopped working when I had tried to draw a list</description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->if (animations.ContainsKey(currentAnimation))<br />
<br />
But it stopped working when I had tried to draw a list<!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/csharp-programming/">C# Programming</category>
			<dc:creator>Demipimp</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/csharp-programming/148240-xna-code-error-value-cannot-null.html</guid>
		</item>
		<item>
			<title>Thread wait</title>
			<link>http://cboard.cprogramming.com/csharp-programming/148201-thread-wait.html</link>
			<pubDate>Mon, 30 Apr 2012 13:23:41 GMT</pubDate>
			<description><![CDATA[Hi! 
 
After i've created a thread, 
 
Code: 
--------- 
Thread thread = new Thread(new ThreadStart(alpha.ThreadProc)); 
--------- 
how to wait for that thread to finish without using Sleep?]]></description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->Hi!<br />
<br />
After i've created a thread,<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">Thread thread = new Thread(new ThreadStart(alpha.ThreadProc));</code><hr />
</div>how to wait for that thread to finish without using Sleep?<br />
<br />
thanks.<!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/csharp-programming/">C# Programming</category>
			<dc:creator>geek@02</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/csharp-programming/148201-thread-wait.html</guid>
		</item>
		<item>
			<title>Guid default equality comparer</title>
			<link>http://cboard.cprogramming.com/csharp-programming/148125-guid-default-equality-comparer.html</link>
			<pubDate>Fri, 27 Apr 2012 08:33:35 GMT</pubDate>
			<description><![CDATA[I have a dictionary which maps a Guid to Orders, it contains like 350000 orders 
 
 
Code: 
--------- 
Dictionary<Guid, Order> htPreOrders = new Dictionary<Guid, PreOrder>(350000); 
--------- 
Im trying to optimize it by replacing the IEqualityComparer by a custom one.]]></description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->I have a dictionary which maps a Guid to Orders, it contains like 350000 orders<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">Dictionary&lt;Guid, Order&gt; htPreOrders = new Dictionary&lt;Guid, PreOrder&gt;(350000);</code><hr />
</div>Im trying to optimize it by replacing the IEqualityComparer by a custom one.<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">&nbsp; &nbsp; &nbsp; &nbsp; class Comp : IEqualityComparer&lt;Guid&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public bool Equals(Guid x, Guid y)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return x == y;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public int GetHashCode(Guid obj)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return obj.GetHashCode();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
Dictionary&lt;Guid, Order&gt; htPreOrders = new Dictionary&lt;Guid, PreOrder&gt;(350000, new Comp());</code><hr />
</div>would this be faster, or is that the same as the default equality comparer of Guid?<!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/csharp-programming/">C# Programming</category>
			<dc:creator>KIBO</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/csharp-programming/148125-guid-default-equality-comparer.html</guid>
		</item>
		<item>
			<title>C# to Win32</title>
			<link>http://cboard.cprogramming.com/csharp-programming/148027-csharp-win32.html</link>
			<pubDate>Tue, 24 Apr 2012 09:49:08 GMT</pubDate>
			<description>Hi! 
 
Is there any way that i can write a program using C# and then convert it into Win32 so the program can be run on any computer without installing .NET libs? i just heard of something called ngen, can it do the thing? 
 
Thanks.</description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->Hi!<br />
<br />
Is there any way that i can write a program using C# and then convert it into Win32 so the program can be run on any computer without installing .NET libs? i just heard of something called ngen, can it do the thing?<br />
<br />
Thanks.<!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/csharp-programming/">C# Programming</category>
			<dc:creator>geek@02</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/csharp-programming/148027-csharp-win32.html</guid>
		</item>
		<item>
			<title>Font Embedding to TextBox</title>
			<link>http://cboard.cprogramming.com/csharp-programming/147926-font-embedding-textbox.html</link>
			<pubDate>Sat, 21 Apr 2012 09:13:20 GMT</pubDate>
			<description><![CDATA[I have successfully loaded a .ttf font.  Now, how do I use it in a TextBox? 
 
FILE: MainWindow.xaml.cs 
 
Code: 
--------- 
namespace myNameSpace 
{ 
    /// <summary> 
    /// Interaction logic for MainWindow.xaml]]></description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->I have successfully loaded a .ttf font.  Now, how do I use it in a TextBox?<br />
<br />
FILE: MainWindow.xaml.cs<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">namespace myNameSpace<br />
{<br />
&nbsp; &nbsp; /// &lt;summary&gt;<br />
&nbsp; &nbsp; /// Interaction logic for MainWindow.xaml<br />
&nbsp; &nbsp; /// &lt;/summary&gt;<br />
&nbsp; &nbsp; public partial class MainWindow : Window<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public MainWindow()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; InitializeComponent();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LoadFont();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [DllImport(&quot;gdi32.dll&quot;)]<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private static extern IntPtr AddFontMemResourceEx(IntPtr pbFont, uint cbFont, IntPtr pdv, [In] ref uint pcFonts);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PrivateFontCollection mFontCollection = new PrivateFontCollection();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private void LoadFont()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // specify embedded resource name<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string resource = &quot;myNameSpace.fixedsys.ttf&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // receive resource stream<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Stream fontStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resource);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //create an unsafe memory block for the data&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.IntPtr data = Marshal.AllocCoTaskMem((int)fontStream.Length);&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //create a buffer to read in to&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Byte[] fontData = new Byte[fontStream.Length];&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //fetch the font program from the resource&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fontStream.Read(fontData, 0, (int)fontStream.Length);&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //copy the bytes to the unsafe memory block&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Marshal.Copy(fontData, 0, data, (int)fontStream.Length);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // We HAVE to do this to register the font to the system (Weird .NET bug !)&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; uint cFonts = 0;&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AddFontMemResourceEx(data, (uint)fontData.Length, IntPtr.Zero, ref cFonts);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //pass the font to the font collection&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mFontCollection.AddMemoryFont(data, (int)fontStream.Length);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //close the resource stream<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fontStream.Close();&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //free the unsafe memory&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Marshal.FreeCoTaskMem(data); <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}</code><hr />
</div>FILE: MainWindow.xaml<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">&lt;Window x:Class=&quot;myNameSpace.MainWindow&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Title=&quot;Hello World&quot; Height=&quot;768&quot; Width=&quot;1366&quot; Loaded=&quot;Window_Loaded&quot; Closed=&quot;Window_Closed&quot;&gt;<br />
&nbsp; &nbsp; &lt;Grid Background=&quot;Black&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;TextBox <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x:Name=&quot;OutputWindow_TEST&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TextWrapping=&quot;Wrap&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; HorizontalScrollBarVisibility=&quot;Auto&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VerticalScrollBarVisibility=&quot;Auto&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Background=&quot;Black&quot; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Foreground=&quot;White&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Width=&quot;338&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;/Grid&gt;<br />
&lt;/Window&gt;</code><hr />
</div>So, in my &quot;OutputWindow_TEST&quot; textbox, how do I add my embedded font?<br />
<br />
I type the &quot;FontFamily&quot; property of the textbox and all my system fonts show up as options, but not the one I embedded.<br />
<br />
Thanks.<!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/csharp-programming/">C# Programming</category>
			<dc:creator>xwielder</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/csharp-programming/147926-font-embedding-textbox.html</guid>
		</item>
		<item>
			<title>compiler bug?</title>
			<link>http://cboard.cprogramming.com/csharp-programming/147904-compiler-bug.html</link>
			<pubDate>Fri, 20 Apr 2012 11:41:10 GMT</pubDate>
			<description><![CDATA[Why doesnt the following compile? the c in prices.Where() is not a declared variable in this scope right? Sounds like a compiler bug to me or am I missing something? 
 
 
Code: 
--------- 
int c = 0; 
 
List<Price> list = prices.Where(c => c.Product_id == product_id).ToList(); 
 
c++;]]></description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->Why doesnt the following compile? the c in prices.Where() is not a declared variable in this scope right? Sounds like a compiler bug to me or am I missing something?<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">int c = 0;<br />
<br />
List&lt;Price&gt; list = prices.Where(c =&gt; c.Product_id == product_id).ToList();<br />
<br />
c++;</code><hr />
</div><!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/csharp-programming/">C# Programming</category>
			<dc:creator>KIBO</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/csharp-programming/147904-compiler-bug.html</guid>
		</item>
		<item>
			<title><![CDATA[IntPtr to byte[] without copy]]></title>
			<link>http://cboard.cprogramming.com/csharp-programming/147837-intptr-byte%5B%5D-without-copy.html</link>
			<pubDate>Wed, 18 Apr 2012 17:19:00 GMT</pubDate>
			<description><![CDATA[let's say I have an IntPtr that points to the raw data of System.Drawing.Bitmap.  is there any way to create a byte array from that IntPtr without copying the data?  I'm a pretty experienced C++ programmer, so I can call ToPointer() on it and convert to a byte* to work with it as a pointer, which...]]></description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->let's say I have an IntPtr that points to the raw data of System.Drawing.Bitmap.  is there any way to create a byte array from that IntPtr without copying the data?  I'm a pretty experienced C++ programmer, so I can call ToPointer() on it and convert to a byte* to work with it as a pointer, which is no big deal for me, but using a pointer and doing pointer arithmetic increases the risk of bugs, so I'd prefer not to do it that way if there's another way.<!-- google_ad_section_end --></div>

]]></content:encoded>
			<category domain="http://cboard.cprogramming.com/csharp-programming/">C# Programming</category>
			<dc:creator>Elkvis</dc:creator>
			<guid isPermaLink="true">http://cboard.cprogramming.com/csharp-programming/147837-intptr-byte%5B%5D-without-copy.html</guid>
		</item>
	</channel>
</rss>

