本文整理汇总了C#中System.Object类的典型用法代码示例。如果您正苦于以下问题:C# Object类的具体用法?C# Object怎么用?C# Object使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Object类属于System命名空间,在下文中一共展示了Object类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToBytes
/// <summary>
/// 将一个对象序列化为字节数组
/// </summary>
/// <param name="data">要序列化的对象</param>
/// <returns>序列化好的字节数组</returns>
public static byte[] ToBytes(Object data)
{
MemoryStream ms = new MemoryStream();
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(ms, data);
return ms.ToArray();
}
示例2: Page_Command
protected void Page_Command(Object sender, CommandEventArgs e)
{
try
{
if (e.CommandName == "Edit")
{
Response.Redirect("edit.aspx?ID=" + gID.ToString());
}
else if (e.CommandName == "Cancel")
{
Response.Redirect("default.aspx");
}
else if (e.CommandName == "Delete")
{
SqlProcs.spTQLogisticsInvoice_Delete(gID);
Response.Redirect("default.aspx");
}
}
catch (Exception ex)
{
SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
ctlDynamicButtons.ErrorText = ex.Message;
}
}
示例3: addClick
private void addClick(Object sender, EventArgs e)
{
//EditText edit = FindViewById<EditText>(Resource.Id.editText1);
//DBRepository dbr = new DBRepository();
////string result = dbr.insertRecord(edit.Text);
//Toast.MakeText(this, result, ToastLength.Short).Show();
}
示例4: TightUnmarshal
//
// Un-marshal an object instance from the data input stream
//
public override void TightUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn, BooleanStream bs)
{
base.TightUnmarshal(wireFormat, o, dataIn, bs);
ConsumerInfo info = (ConsumerInfo)o;
info.ConsumerId = (ConsumerId) TightUnmarshalCachedObject(wireFormat, dataIn, bs);
info.Browser = bs.ReadBoolean();
info.Destination = (ActiveMQDestination) TightUnmarshalCachedObject(wireFormat, dataIn, bs);
info.PrefetchSize = dataIn.ReadInt32();
info.MaximumPendingMessageLimit = dataIn.ReadInt32();
info.DispatchAsync = bs.ReadBoolean();
info.Selector = TightUnmarshalString(dataIn, bs);
info.SubscriptionName = TightUnmarshalString(dataIn, bs);
info.NoLocal = bs.ReadBoolean();
info.Exclusive = bs.ReadBoolean();
info.Retroactive = bs.ReadBoolean();
info.Priority = dataIn.ReadByte();
if (bs.ReadBoolean()) {
short size = dataIn.ReadInt16();
BrokerId[] value = new BrokerId[size];
for( int i=0; i < size; i++ ) {
value[i] = (BrokerId) TightUnmarshalNestedObject(wireFormat,dataIn, bs);
}
info.BrokerPath = value;
}
else {
info.BrokerPath = null;
}
info.AdditionalPredicate = (BooleanExpression) TightUnmarshalNestedObject(wireFormat, dataIn, bs);
info.NetworkSubscription = bs.ReadBoolean();
info.OptimizedAcknowledge = bs.ReadBoolean();
info.NoRangeAcks = bs.ReadBoolean();
}
示例5: VerifyAccess
///<summary>
/// This method is called to Add a Setter object as a child of the Style.
///</summary>
///<param name="value">
/// The object to add as a child; it must be a Setter or subclass.
///</param>
void IAddChild.AddChild (Object value)
{
// Verify Context Access
VerifyAccess();
Setters.Add(Trigger.CheckChildIsSetter(value));
}
示例6: ArgumentCheck
private static void ArgumentCheck(Side side, int m, int n, int k, int ilo, int ihi, Object A, int lda, Object tau, Object C, int ldc) {
if ( A == null ) {
throw new ArgumentNullException("A","A cannot be null.");
}
if ( tau == null ) {
throw new ArgumentNullException("tau","tau cannot be null.");
}
if ( C == null ) {
throw new ArgumentNullException("C","C cannot be null.");
}
if ( m<0 ) {
throw new ArgumentException("m must be at least zero.", "m");
}
if ( n<0 ) {
throw new ArgumentException("n must be at least zero.", "n");
}
if( side == Side.Left ){
if( k < 0 || k > m ){
throw new ArgumentException("k must be positive and less than or equal to m.", "k");
}
if (m>0) {
if (ilo<1 || ilo>m || ilo>ihi)
throw new ArgumentException("ilo must be a positive number and less than or equal to min(ihi,m) if m>0", "ilo");
if (ihi<1 || ihi>m)
throw new ArgumentException("ihi must be between 1 and m if m>0", "ihi");
} else {
if (ilo!=1)
throw new ArgumentException("ilo must be 1 if m=0", "ilo");
if (ihi!=0)
throw new ArgumentException("ihi must be 0 if m=0", "ihi");
}
}else{
if( k < 0 || k > n ){
throw new ArgumentException("k must be positive and less than or equal to n.", "k");
}
if (n>0) {
if (ilo<1 || ilo>n || ilo>ihi)
throw new ArgumentException("ilo must be a positive number and less than or equal to min(ihi,n) if n>0", "ilo");
if (ihi<1 || ihi>n)
throw new ArgumentException("ihi must be a positive number and less than or equal to n if n>0", "ihi");
} else {
if (ilo!=1)
throw new ArgumentException("ilo must be 1 if n=0", "ilo");
if (ihi!=0)
throw new ArgumentException("ihi must be 0 if n=0", "ihi");
}
}
if( side == Side.Left ){
if ( lda < System.Math.Max(1,m) ) {
throw new ArgumentException("lda must be at least max(1,m)", "lda");
}
}else{
if ( lda < System.Math.Max(1,n) ) {
throw new ArgumentException("lda must be at least max(1,n)", "lda");
}
}
if ( ldc < System.Math.Max(1,m) ) {
throw new ArgumentException("ldc must be at least max(1,m)", "ldc");
}
}
示例7: ActionEasterEgg
/* Events' handlers */
private void ActionEasterEgg(Object sender, EventArgs e)
{
if (--easterEgg < 0)
{
lAppName.Text = "O_O";
}
}
示例8: TestDatabaseConnection
public static void TestDatabaseConnection(Object sender, TestDatabaseConnectionEventArgs e)
{
using (var connection = new FbConnection(GetConnectionString(e.DatabaseSettings)))
{
connection.Open();
}
}
示例9: OnProcessFileDialog
private void OnProcessFileDialog(Object sender, FileDialogEventArgs e)
{
switch (e.Mode)
{
case FileDialogMode.Save:
using (var saveDialog = new SaveFileDialog())
{
saveDialog.Title = e.Title;
saveDialog.Filter = e.Filter;
saveDialog.FileName = e.DefaultFileName;
if (saveDialog.ShowDialog() != DialogResult.Cancel)
{
FormProgress.ShowProgress();
FormProgress.SetTitle("Downloading…", true);
FormProgress.SetDetails(Path.GetFileName(saveDialog.FileName));
TabControl.Enabled = false;
Application.DoEvents();
e.Continue(saveDialog.FileName);
}
else
e.Cancel();
}
break;
}
e.Handled = true;
}
示例10: Application_BeginRequest
protected void Application_BeginRequest(Object sender, EventArgs e) {
string filePath = HttpContext.Current.Request.PhysicalPath;
if (!string.IsNullOrEmpty(filePath)
&& (filePath.IndexOf("Images") >= 0) && !System.IO.File.Exists(filePath)) {
HttpContext.Current.Response.End();
}
}
示例11: field_DataBinding
private void field_DataBinding(Object sender, EventArgs e)
{
Control c = (Control)sender;
GridViewRow row = (GridViewRow)c.NamingContainer;
if (sender.GetType() == typeof(Label))
{
(c as Label).Text = DataBinder.Eval(row.DataItem, columnNameData).ToString();
(c as Label).Font.Size = 7;
(c as Label).Font.Name = "Arial";
}
else if (sender.GetType() == typeof(TextBox))
{
(c as TextBox).Text = DataBinder.Eval(row.DataItem, columnNameData).ToString();
(c as TextBox).Font.Size = 7;
(c as TextBox).Font.Name = "Arial";
}
else if (sender.GetType() == typeof(DropDownList))
{
(c as DropDownList).SelectedValue = DataBinder.Eval(row.DataItem, columnNameData).ToString();
(c as DropDownList).Font.Size = 7;
(c as DropDownList).Font.Name = "Arial";
}
else if (sender.GetType() == typeof(CheckBox))
{
(c as CheckBox).Checked = (bool)DataBinder.Eval(row.DataItem, columnNameData);
}
}
示例12: SaveShareButton_Command
protected void SaveShareButton_Command(Object sender, CommandEventArgs e)
{
SaveButton_Command(sender, e);
var patron = (Patron)Session["Patron"];
Response.Redirect(string.Format("~/Avatar/View.aspx?AvatarId={0}",
patron.AvatarState));
}
示例13: return
GetDialogTitle
(
Object oObjectBeingSaved
)
{
return (DialogTitle);
}
示例14: AddModuleToPane_Click
/// <summary>The AddModuleToPane_Click server event handler on this page is used
/// to add a new portal module into the tab
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void AddModuleToPane_Click(Object sender, EventArgs e)
{
// All new modules go to the end of the contentpane
ModuleItem m = new ModuleItem();
m.ModuleTitle = moduleTitle.Text;
m.ModuleDefId = Int32.Parse(moduleType.SelectedItem.Value);
m.ModuleOrder = 999;
// save to database
Configuration config = new Configuration();
m.ModuleId =
config.AddModule(tabId, m.ModuleOrder, "ContentPane", m.ModuleTitle, m.ModuleDefId, 0, "Admins", false);
// Obtain portalId from Current Context
PortalSettings portalSettings = (PortalSettings) Context.Items["PortalSettings"];
// reload the portalSettings from the database
HttpContext.Current.Items["PortalSettings"] = new PortalSettings(portalSettings.PortalId, tabId);
// reorder the modules in the content pane
ArrayList modules = GetModules("ContentPane");
OrderModules(modules);
// resave the order
foreach (ModuleItem item in modules)
{
config.UpdateModuleOrder(item.ModuleId, item.ModuleOrder, "ContentPane");
}
// Redirect to the same page to pick up changes
Response.Redirect(Request.RawUrl);
}
示例15: ObjetoSerializado
public static string ObjetoSerializado(Object Objeto)
{
System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(Objeto.GetType());
System.IO.StringWriter textWriter = new System.IO.StringWriter();
x.Serialize(textWriter, Objeto);
return textWriter.ToString();
}