zoukankan      html  css  js  c++  java
  • 自定义异常类

    自定义异常是在日常开发中经常使用到的;

    异常类代码:
     1    /// <summary>
     2    /// Represents the exception that is thrown when attempting an action that ....
     3    /// </summary>

     4    class SampleException : Exception
     5    {
     6        private string cMessage = string.Empty;
     7        public override string Message
     8        {
     9            get
    10            {
    11                return cMessage;
    12            }

    13        }

    14        public
    SampleException(string pstrMessage)
    15        {
    16            cMessage = "this is sampe...";
    17        }

    18    }

    调用代码
     try
                            
    {
                                ProcessOneRequest(tokens[
    0], tokens[1]);
                            }

                            
    catch (SampleException ex)
                            
    {
                                Utility.WriteLog(“
    this is sample!!”);
                            }

  • 相关阅读:
    冒泡排序
    MySql
    利用mybatis-generator自动生成代码
    SQL,HQL,CQL,JPQL了解
    mysql中的约束
    详解CRUD?
    什么是数据库ACID?
    建造者模式(Builder Pattern)
    Java中的设计模式
    java中的排序面试题
  • 原文地址:https://www.cnblogs.com/luyinghuai/p/1240230.html
Copyright © 2011-2022 走看看