CSharpFeeds - All your C# feeds in one place.

Sponsors

Feed: jokiz : C#

Site: http://devpinoy.org/blogs/joeycalisay/archive/tags/C_2300_/default.aspx Link: http://devpinoy.org/blogs/joeycalisay/rss.aspx?Tags=C_2300_&AndTags=1

Saturday, December 06, 2008

tricky ternary operators

by jokiz via jokiz : C# on 12/6/2008 6:19:00 AM

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 there.  I don't even had the time to read my tech blog feeds in google reader.  Time to catch up (hopefully). Let's start with a piece of code that I bumped into recently in migrating some of the business rules in ...

[ read more ]

Thursday, December 06, 2007

C# Trivia #6

by jokiz via jokiz : C# on 12/6/2007 2:43:00 AM

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.Write("jokiz");     } } ...

[ read more ]

Thursday, September 07, 2006

Decimal data type for financial applications

by jokiz via jokiz : C# on 9/7/2006 1:39:00 AM

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 greater significant digits compared to floating points.  Floating point types is composed of float and double data types for c#.decimal: 28-29 significant digitsfloat: 7 digitsdouble: 15-16 digits[EDIT]Even if your application reached m ...

[ read more ]

Use standard format characters in string formatting

by jokiz via jokiz : C# on 9/7/2006 1:36:00 AM

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 application-wide so, try to configure a custom CultureInfo (whether you use a predefined or a custom one) and use the standard format characters in your format expression (c for currency, d for Short date, etc.).  Steve Tibbett has compil ...

[ read more ]

Wednesday, August 23, 2006

java's protected == .NET's protected internal

by jokiz via jokiz : C# on 8/23/2006 8:35:00 AM

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 same package.  turns out that java's protected keyword is equivalent to .NET's protected internal.  haven't really used java (i also had a hard time using eclipse the first time). ...

[ read more ]

Friday, September 30, 2005

All about @

by jokiz via jokiz : C# on 9/30/2005 11:57:00 AM

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 tostring filename = "C:\\joeycalisay\\projects\\"[/code] Do you know about it's another use as an escape character for C# keywords so you can use it in your codes as variables?  Imagine a .NET assembly built in COBOL.NET with an Int32 public variable named ...

[ read more ]

Default modifier in .NET

by jokiz via jokiz : C# on 9/30/2005 11:48:00 AM

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 that for classes it defaults to internal? ...

[ read more ]

Monday, September 12, 2005

StringBuilder.AppendFormat

by jokiz via jokiz : C# on 9/12/2005 9:43:00 PM

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 known to all .NET developers). I have been using string.Format method a numberof times formatting dates and numbers.  So initially, what came into my mind was to use a StringBuilder instance to append a string result of a string.Format.[co ...

[ read more ]

Monday, September 05, 2005

C# Programmer's Cookbook

by jokiz via jokiz : C# on 9/5/2005 10:26:00 PM

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's Cookbook   Author Allen Jones Pages 656 Disk N/A Level All Levels Published 10/29/2003 ISBN 0-7356-1930-1 ...

[ read more ]

Saturday, June 11, 2005

IS and AS operator

by jokiz via jokiz : C# on 6/11/2005 6:04:00 AM

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]is better than [code language="C#"]Person unboxed = boxed as Person;if (unboxed != null){    //do something} [/code]for the reason (which I believed before, without any basis) that the first one doe ...

[ read more ]

Thursday, April 28, 2005

The (-) operator

by jokiz via jokiz : C# on 4/28/2005 6:32:00 AM

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 = 10int negativeValue = value * -1int negativeValueAlso = -value ...

[ read more ]

Friday, March 18, 2005

Passing and Returning Reference Types

by jokiz via jokiz : C# on 3/18/2005 12:24:00 AM

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 they return arrays with zero elements instead of null, then callers of your methods will have an easier time working with them. By the way, you should do the same for fields as well. If your type has a field that is a reference to an array, you shou ...

[ read more ]

Thursday, March 17, 2005

Efficient For Loop

by jokiz via jokiz : C# on 3/17/2005 8:13:00 AM

[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 for loop check, lots of indirection involved (I hope I’m right here).A better way is this:[code language="C#"]for (int i = 0, length = collection.Count; i < length; i++){    //do something with collection}[/code]I woul ...

[ read more ]

Subscribe

New Feed

Product Spotlight

Recently Updated Sources

Legal Note

The content of the postings is owned by the respective author. CSharpFeeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on CSharpFeeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.

Advertise with us