Re: Using usings :)
Paul, both are correct. using alias (SP in your example) allows you to use that alias to represent the namespace name here is a detailed explanation http://msdn.microsoft.com/en-us/library/sf0df423(v=vs.71).aspx On Thu, Mar 15, 2012 at 8:55 AM, explanation Paul Noone paul.no...@ceosyd.catholic.edu.au wrote: Hi all, Quick question regarding usings and abbreviations. I have seen examples, such as below, where both are used. Yet I have projects that just use the second using statement and they work as expected. Which is correct? using Microsoft.SharePoint.Client; using SP = Microsoft.SharePoint.Client; Kind regards, Paul Noone ** ** --- Online Developer/SharePoint Administrator Infrastructure Team, ICT Catholic Education Office, Sydney p: (02) 9568 8461 f: (02) 9568 8483 e: paul.no...@ceosyd.catholic.edu.au w: http://www.ceosyd.catholic.edu.au/ ** ** ___ ozmoss mailing list ozmoss@ozmoss.com http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss ___ ozmoss mailing list ozmoss@ozmoss.com http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
Re: Using usings :)
Both are. It comes down to readability and personal preference. In most cases the first version is sufficient. The second version can help in cases like the one we discussed a while back regarding WebParts, where you have the same class name on two different namespaces. Assuming you need to use both classes, you could have created two aliases for the namespaces like so: Using ASP = System.Web.UI.WebControls.WebParts.WebPart // ASP webparts Using SP = Microsoft.SharePoint.WebPartPages.WebPart // Sharepoint webparts And then you could refer in you code to ASP.WebPart and SP.WebPart so it would be clearer which class is in use. Luis. On 15/03/2012, at 8:55 AM, Paul Noone wrote: Hi all, Quick question regarding usings and abbreviations. I have seen examples, such as below, where both are used. Yet I have projects that just use the second using statement and they work as expected. Which is correct? using Microsoft.SharePoint.Client; using SP = Microsoft.SharePoint.Client; Kind regards, Paul Noone --- Online Developer/SharePoint Administrator Infrastructure Team, ICT Catholic Education Office, Sydney p: (02) 9568 8461 f: (02) 9568 8483 e: paul.no...@ceosyd.catholic.edu.au w: http://www.ceosyd.catholic.edu.au/ ___ ozmoss mailing list ozmoss@ozmoss.com http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss ___ ozmoss mailing list ozmoss@ozmoss.com http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
RE: Using usings :)
Sweet. That makes sense. I really need to buy you guys a beer one day. :) From: ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] On Behalf Of Luis Ortega Sent: Thursday, 15 March 2012 12:01 PM To: ozMOSS Subject: Re: Using usings :) Both are. It comes down to readability and personal preference. In most cases the first version is sufficient. The second version can help in cases like the one we discussed a while back regarding WebParts, where you have the same class name on two different namespaces. Assuming you need to use both classes, you could have created two aliases for the namespaces like so: Using ASP = System.Web.UI.WebControls.WebParts.WebPart // ASP webparts Using SP = Microsoft.SharePoint.WebPartPages.WebPart // Sharepoint webparts And then you could refer in you code to ASP.WebPart and SP.WebPart so it would be clearer which class is in use. Luis. On 15/03/2012, at 8:55 AM, Paul Noone wrote: Hi all, Quick question regarding usings and abbreviations. I have seen examples, such as below, where both are used. Yet I have projects that just use the second using statement and they work as expected. Which is correct? using Microsoft.SharePoint.Client; using SP = Microsoft.SharePoint.Client; Kind regards, Paul Noone --- Online Developer/SharePoint Administrator Infrastructure Team, ICT Catholic Education Office, Sydney p: (02) 9568 8461 f: (02) 9568 8483 e: paul.no...@ceosyd.catholic.edu.aumailto:paul.no...@ceosyd.catholic.edu.au w: http://www.ceosyd.catholic.edu.au/ ___ ozmoss mailing list ozmoss@ozmoss.commailto:ozmoss@ozmoss.com http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss ___ ozmoss mailing list ozmoss@ozmoss.com http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss