[mono-android] partial class

Jonathan Pryor jonp at xamarin.com
Tue Nov 29 14:53:15 EST 2011


On Nov 29, 2011, at 5:54 AM, rambo123 wrote:
> what is the need to have nested partial classes in Resource.Designer.cs file?

Why not?

I figured it would be a handy place to put helper methods related to the constants, should you choose (e.g. adding to the default sample project, which has a Resource.Layout.myButton constant):

	partial class Resource {
		partial class Id {
			public static Button GetMyButton (Activity activity)
			{
				return activity.FindViewById<Button>(myButton);
			}
		}
	}

This would permit `Resource.Id.GetMyButton(this)` instead of `this.FindViewById<Button>(Resource.Id.myButton)` -- a minor difference, to be sure...

 - Jon



More information about the Monodroid mailing list