Browse by Tags

tricky ternary operators
Published 12-06-2008 5:19 PM | jokiz
i has been one year since I haven't been posting in this blog, hmmm. wow, time is really that fast. one year and I haven't done much actually, just work and DOTA. Not at all productive and pretty much lagging with the current technologies out...
Filed under:
C# Trivia #6
Published 12-06-2007 1:43 PM | jokiz
As I've mention in this post, I'll be continuing the trivia series here in my blog. I've encountered a good one from internal chat yesterday, here it is: will this compile? [ Test ] public void IntTests () { int i = 1; if ( i != null ) { Debug...
Filed under: ,
C# Trivia Question Series
Published 08-02-2007 11:16 PM | jokiz
Some of you know about the C# trivia series that I started in MSForum's C# section . Good thing some of these posts were revived since they were missing months ago. Here are the links: Trivia #1 - Arraylist's initial size Trivia #2 - String concatenations...
Filed under: , ,
Resharper 3.0 Beta is out
Published 05-31-2007 10:24 AM | jokiz
Jetbrains has just released their beta version of Resharper 3.0, download it here . Again, VB.NET guys out there, you should try Resharper since it now supports your language. Resharper 3.0 will now come into three versions (C#, VB and Full edition)....
Decimal data type for financial applications
Published 09-07-2006 1:39 PM | jokiz
My current project uses a double data type for its values and i have raised a suggestion to convert it to decimal data type instead. I remember that it is recommended to use decimal over double for financial applications because decimal data types have...
Filed under: , , ,
Use standard format characters in string formatting
Published 09-07-2006 1:36 PM | jokiz
Whenever you want to format a currency, date, etc. for your application, try to avoid hardcoding your custom format's in your BoundColumn's DataFormatString, ToString format parameter, etc. More often that not, you'd want those formats to be the same...
Filed under: , , ,
java's protected == .NET's protected internal
Published 08-23-2006 8:35 PM | jokiz
i was teaching the basics of inheritance in java to one of my math tutees when i bumped into one of the differences of java and .NET. basically i declared a field variable as protected and was able to access the said field from a different class on the...
Filed under: , ,
All about @
Published 09-30-2005 11:57 PM | jokiz
The @ (at) sign in .NET is used for verbatim strings. When you're tired of dealing with escape characters particularly for filenames, you make use of it: [code language="C#"] string filename = @"C:\joeycalisay\projects\" as compared to string filename...
Filed under: , ,
Default modifier in .NET
Published 09-30-2005 11:48 PM | jokiz
Obviously you already know that private is the default modifier in .NET. When you declare a field inside a class this way: [code language="C#"] public class Jokiz { int age; } [/code] the age field is private to the Jokiz class by default. Do you know...
Filed under: ,
Published 09-13-2005 9:43 AM | jokiz
I was refactoring some of our codes yesterday when I bumped into a class used for reporting which is string concat intensive. Obviously, we should use the StringBuilder class due to " strings are immutable " (kind of cliche these days which should be...
Filed under: ,
C# Programmer's Cookbook
Published 09-06-2005 10:26 AM | jokiz
Last thursday, I attended Stanley Tan's session at Microsoft. I didn't expect him to repeat his demos and stuff last january techfest @ shangri-la. However, it was worth it because I have won an MSPress book (first time I won in a raffle). C# Programmer...
Filed under: ,
IS and AS operator
Published 06-11-2005 6:04 PM | jokiz
Boxing and unboxing in C# has a performance cost and the use of the IS and AS operator in casting objects is trivial for me. I thought before that: [code language="C#"] if (boxed is Person) { Person unboxed = boxed as Person; //do something } [/code]...
Filed under: , ,
The (-) operator
Published 04-28-2005 6:32 PM | jokiz
I used to multiply a numeric number to -1 just to get its additive inverse (negative value for positive numbers) and I found out that the (-) operator does it implicitly. int value = 10 int negativeValue = value * -1 int negativeValueAlso = -value
Filed under: , , ,
Passing and Returning Reference Types
Published 03-18-2005 11:24 AM | jokiz
I’ve read this excellent article on Arrays of Jeffrey Richter from Wintellect at MSDN here and there are a number of good points in coding, the one I love most is the section on Passing and Returning Arrays . If you always design your methods so that...
Filed under: , ,
Efficient For Loop
Published 03-17-2005 7:13 PM | jokiz
[code language="C#"] for (int i = 0; i < collection.Count; i++) { //do something with collection } [/code] I’ve done this before and for me, the efficient way is to store the Count property of the collection rather than access it everytime for the...
Filed under: , , ,
More Posts Next page »