Sign in
|
Join
|
Help
שלמה גולדברג (הרב דוטנט)
מרצה בסלע ויועץ בעולם ה - net.
עמוד הבית
טופס יצירת קשר
RSS 2.0
Atom 1.0
RSS-תגובות ב
חפש
תגיות
AddIn
Ajax
ashx
asp net
Asp.Net
Asp.Net Controls
Attribute
authentication
authorization
azure
BI
C#
C# 4.0
Code Plex
config
Context Menu
Cookie
cross browser
CSS
css3
Culture
database
DataReader
DataTable
debug
DEV
dynamic
EF
Encoding
Entity Framework
Extension Method
Facebook
Generic
Hacking
html
html5
HttpHandler
HttpModule
IDCC
iE
IE8
ie9
IIS
iis7
Internet Explorer
internet Explorer 8
internet Explorer 9
ITPRO
JavaScript
jQuery
js
JSON
Linq
meta
mvc
OFFICE
OFFTOPIC
Optional Parameters
PageMethods
PostBack
Power Point
reflection
Reflector
Reporting Services
Resource
SCC
Script Manger
SDP
Sela
Sela College Channel
silverlight
SQL Server
Static
stream
TECH
Teched_il
Telerik
Threading
UnitTest
User Control
UTF-8
Validators
video
Visual Studio
voice
VS2010
VSTO
WCF
Web
Web Service
Web Slice
WebApplication
WebMethod
WebService
Windows
Windows7
WinForms
XMLHTTP
קוד נכון
תפוז
ארכיון
February 2012 (1)
January 2012 (9)
December 2011 (7)
November 2011 (13)
October 2011 (9)
September 2011 (1)
August 2011 (4)
June 2011 (8)
May 2011 (13)
April 2011 (14)
March 2011 (12)
February 2011 (8)
January 2011 (18)
December 2010 (10)
November 2010 (16)
October 2010 (11)
September 2010 (9)
August 2010 (21)
July 2010 (12)
June 2010 (11)
May 2010 (21)
April 2010 (19)
March 2010 (14)
February 2010 (17)
January 2010 (13)
December 2009 (16)
November 2009 (10)
October 2009 (12)
September 2009 (22)
August 2009 (9)
July 2009 (14)
June 2009 (19)
May 2009 (17)
April 2009 (9)
March 2009 (11)
February 2009 (10)
January 2009 (16)
December 2008 (23)
November 2008 (11)
ניווט
Home
All Posts
RSS
Popular Tags
Browse by Tags
All Tags
»
Optional Parameters
(
RSS
)
C#
C# 4.0
DEV
dynamic
Named Parameters
OFFICE
VS2010
C# 4.0 - Table Of Content
02 July 09 10:12 PM
|
Shlomo
|
7 comment(s)
נראה לי שדי סיכמתי את החידושים ב - C# 4.0, אמנם יש עוד כמה חידושים אבל הם פחות מרכזיים אז חשבתי שכדאי לכתוב תוכן עניינים, ובמידה ויצא לי לכתוב על שאר החידושים אני אעדכן את הפוסט הזה. אני מאוד מקווה שנהניתם מסדרת הפוסטים הזאת. תוכן העניינים: C# 4.0 Part 1 - First glance on the dynamic - בפרק זה נכיר לראשונה את המושג dynamic ונראה כמה דוגמאות פשוטות ושימושיות. C# 4.0 Part 2 - The GetCalculator program - פרק זה ידגים גישה על ידי dynamic למחשבון שנכתב ב - net ומחשבון שנכתב ב - JS עטוף באובייקט COM. C#...
C# 4.0 Part 11 - Named Parameters
29 June 09 08:58 AM
|
Shlomo
|
3 comment(s)
ל - Optional Parameters יש בעיה אחת קטנה. static void Add( int id, string name = "shlomo" , float age = 0) { } static void Main() { Add(22, ,24); } זה לא מתקמפל וכמובן מאוד לא ברור. ולכן המציאו את ה - Name Parameters. static void Main() { Add(22, age: 24); } גם עבור פרמטרים שהם חובה ניתן לשלוח עם השם: static void Main() { Add(id: 22, age: 24); } זה גורם שהקוד שלנו יהיה יותר קריא. אבל צריך להיות זהירים עם השימוש ב - Named Parameters. (פוסט מומלץ לקריאה - כאן ). החל מ - C# 4.0 אסור לשנות...
C# 4.0 Part 10 - Optional Parameters - Behind The Scenes
28 June 09 07:16 AM
|
Shlomo
|
2 comment(s)
פספסתי את הפוסט של מוצאי שבת, (אולי אני אכתוב היום שניים). בכל מקרה אנחנו רוצים לדעת מה קורה מאחורי הקלעים כשמשתמשים ב - Optional Parameters. למעשה מייקרוסופט משתמשים בשני Attributes שקיימים כבר המון זמן. הראשון הוא - System.Runtime.InteropServices.OptionalAttribute והשני הוא - System.Runtime.InteropServices.DefaultParameterValueAttribute, למעשה הקוד הבא: static void Add( int id, string name = "" , float age = 0) { } מתרנדר לקוד הבא: static void Add( int id, [ Optional , DefaultParameterValue...
C# 4.0 Part 9 - Spell Checking with word using Optional Parameters
26 June 09 07:01 AM
|
Shlomo
|
3 comment(s)
כמו שהבטחתי אני רוצה להדגים שימוש ב - Optional Parameters. הקוד הבא משתמש בבדיקת האיות של Word. public static void Main() { Application word = new Application (); object missingValue = Type .Missing; Document doc = word.Documents.Add( ref missingValue, ref missingValue, ref missingValue, ref missingValue); doc.Activate(); SpellingSuggestions suggestions = word.GetSpellingSuggestions( "placa" , ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref...
C# 4.0 Part 8 - First glance on the Optional Parameters
25 June 09 10:12 AM
|
Shlomo
|
4 comment(s)
אחד מהתכונות החדשות של C# 4.0 היא Optional Parameters. למעשה - המצב עד היום שלא היה לנו את האופציה של פרמטרי רשות, הרגיל אותנו לכתוב קוד לא כל כך נכון, למה הכוונה - שימו לב לשני קטעי הקוד הבאים, הראשון - עושה overload למתודת Abs וקטע הקוד השני עושה overload למתודת Add. אז מה בכל זאת ההבדל ? public static class Math { public static decimal Abs( decimal value); public static double Abs( double value); public static float Abs( float value); public static int Abs( int value); public static long Abs(...