• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Return类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Return的典型用法代码示例。如果您正苦于以下问题:C# Return类的具体用法?C# Return怎么用?C# Return使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Return类属于命名空间,在下文中一共展示了Return类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: RegexTest

 public static Return<List<string>> RegexTest(Dictionary<string, bool> dictionary, string pattern)
 {
     Return<List<string>> _answer = new Return<List<string>>() { data = new List<string>() };
     if (dictionary == null)
     {
         _answer.theresError = true;
         _answer.error = Utility.GetError(new ArgumentNullException("dictionary"), typeof(Utility));
     }
     else
         if (string.IsNullOrEmpty(pattern))
         {
             _answer.theresError = true;
             _answer.error = Utility.GetError(new ArgumentNullException("pattern"), typeof(Utility));
         }
         else
         {
             try
             {
                 foreach (string _key in dictionary.Keys)
                 {
                     if (Regex.IsMatch(_key, pattern) != dictionary[_key])
                         _answer.data.Add(_key);
                 }
             }
             catch (Exception _ex)
             {
                 _answer.theresError = true;
                 _answer.error = Utility.GetError(_ex, typeof(Utility));
             }
         }
     return _answer;
 }
开发者ID:meras0704,项目名称:Solution_Blatella.Common,代码行数:32,代码来源:Utility.cs


示例2: ArithmeticMean

 public static Return<double> ArithmeticMean(List<double> numbers)
 {
     Return<double> _answer = new Return<double>();
     try
     {
         if (numbers == null)
         {
             _answer.theresError = true;
             _answer.error = Utility.GetError(new ArgumentException("numbers"), typeof(Mathematics));
         }
         else
             if (!numbers.Any())
                 _answer.data = 0;
             else
             {
                 double _sum = 0;
                 int _count = numbers.Count();
                 numbers.ForEach(n => _sum += n);
                 _answer.data = _sum / _count;
             }
     }
     catch (Exception _ex)
     {
         _answer.theresError = true;
         _answer.error = Utility.GetError(_ex, typeof(Mathematics));
     }
     return _answer;
 }
开发者ID:meras0704,项目名称:Solution_Blatella.Common,代码行数:28,代码来源:Mathematics.cs


示例3: LoadReturn

    public void LoadReturn()
    {
        Return e = new Return();
        if (ReturnID == 0)
        {
            imgOrder.ImageUrl = "none";
            btnOk.Enabled = true;
        }
        else
        {
            e = ReturnBLL.Get(ReturnID);
            imgOrder.ImageUrl = BarcodeBLL.Url4Return(e.ID);
            btnOk.Enabled = false;
        }

        txtNote.Text = e.Note;

        txtDate.Text = e.Date.ToStringVN_Hour();

        PackOrderList = e.PackOrders.Select(r => r.ID).ToList();

        urlPrint.NavigateUrl = ResolveClientUrl(string.Format("~/Store/PrintReturn.aspx?ReturnID={0}", e.ID));

        GridViewPack.DataBind();

        CurrentDIN = "";
        imgCurrentDIN.ImageUrl = "none";

        GridViewSum.DataBind();
    }
开发者ID:ghostnguyen,项目名称:redblood,代码行数:30,代码来源:Return.aspx.cs


示例4: CreateVocabulary

		/// <summary>
		/// Creates a vocabulary from a list of strings.
		/// Applies grouping.
		/// Applies stop words and stemming (if available for the language)
		/// Does not performs a Distinct
		/// </summary>
		/// <param name="language">la cultura para la que se realiza el análisis</param>
		/// <param name="strings">la cadenas de texto (no están divididas en words)</param>
		/// <returns></returns>
		public Return<List<string>> CreateVocabulary(string language, List<string> strings)
		{
			Return<List<string>> _answer = new Return<List<string>>();
			if (strings == null)
			{
				_answer.theresError = true;
				_answer.error = Utility.GetError(new ArgumentNullException("strings"), this.GetType());
			}
			else
			{
				try
				{
					Return<EnumLanguage> _answerParseLanguage = MLUtility.ParseLanguage(language);
					if (_answerParseLanguage.theresError)
					{
						_answer.theresError = true;
						_answer.error = _answerParseLanguage.error;
					}
					else
						_answer = CreateVocabulary(_answerParseLanguage.data, strings);
				}
				catch (Exception _ex)
				{
					_answer.theresError = true;
					_answer.error = Utility.GetError(_ex, this.GetType());
				}
			}
			return _answer;
		}
开发者ID:meras0704,项目名称:Solution_Blatella.ML,代码行数:38,代码来源:VectorSpaceModelUtility.cs


示例5: Action

 /// <summary>
 /// Creates instance of the <see cref="Action"></see> class with properties initialized with specified parameters.
 /// </summary>
 /// <param name="returnType">The return type of the action.</param>
 /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
 /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
 /// <param name="condition">The launch condition for the <see cref="Action"/>.</param>
 protected Action(Return returnType, When when, Step step, Condition condition)
 {
     Return = returnType;
     Step = step;
     When = when;
     Condition = condition;
 }
开发者ID:denis-peshkov,项目名称:WixSharp,代码行数:14,代码来源:Action.cs


示例6: LoadReturn

    public void LoadReturn()
    {
        Return e = new Return();
        if (ReturnID == 0)
        {
            imgOrder.ImageUrl = "none";
            btnOk.Enabled = true;
        }
        else
        {
            e = ReturnBLL.Get(ReturnID);
            imgOrder.ImageUrl = BarcodeBLL.Url4Return(e.ID);
            btnOk.Enabled = false;
        }

        txtNote.Text = e.Note;

        txtDate.Text = e.Date.ToStringVN_Hour();

        PackOrderList = e.PackOrders.Select(r => r.ID).ToList();

        GridViewPack.DataBind();

        CurrentDIN = "";
        imgCurrentDIN.ImageUrl = "none";
    }
开发者ID:ghostnguyen,项目名称:redblood,代码行数:26,代码来源:Return.aspx.cs


示例7: GetTask

		public Return<Task> GetTask(string taskName)
		{
			Return<Task> _answer = new Return<Task>();
			if (string.IsNullOrEmpty(taskName))
			{
				_answer.theresError = true;
				_answer.error = Utility.GetError(new ArgumentNullException("taskName"), this.GetType());
			}
			else
			{
				Return<SqlConnection> _answerConnection = this.connection;
				if (_answerConnection.theresError)
				{
					_answer.theresError = true;
					_answer.error = _answerConnection.error;
				}
				else
				{
					try
					{
						using (SqlConnection _connection = _answerConnection.data)
						{
							if (_connection.State != ConnectionState.Open)
								_connection.Open();
							using (SqlCommand _command = new SqlCommand() { CommandType = CommandType.Text, Connection = _connection, CommandTimeout = timeoutInSecondsBD })
							{//using SqlCommand

								string _fields = string.Format("{0},{1},{2},{3},{4}", SQLGrp_Class.FLD_TASK_ID, SQLGrp_Class.FLD_TASK_NAME, SQLGrp_Class.FLD_TASK_GCDESCRIPTION
																									, SQLGrp_Class.FLD_TASK_CREATIONDATE, SQLGrp_Class.FLD_TASK_LASTMODIFICATIONDATE);

								_command.CommandText = string.Format("select {0} from {1} where {2}[email protected]", _fields, SQLGrp_Class.TAB_TASK, SQLGrp_Class.FLD_TASK_NAME);
								_command.Parameters.AddWithValue("@taskName", taskName);
								using (SqlDataReader _dataReader = _command.ExecuteReader())
								{//using SqlDataReader
									using (DataTable _table = new DataTable())
									{//using DataTable
										_table.Load(_dataReader);
										Return<List<Task>> _answerConversion = DataRowCollectionToTask(_table.Rows);
										if (_answerConversion.theresError)
										{
											_answer.theresError = true;
											_answer.error = _answerConversion.error;
										}
										else
											_answer.data = _answerConversion.data.FirstOrDefault();
									}//using DataTable
								}//using SqlDataReader
							}//using SqlCommand
						}
					}
					catch (Exception _ex)
					{
						_answer.theresError = true;
						_answer.error = Utility.GetError(_ex, this.GetType());
					}
				}
			}
			return _answer;
		}
开发者ID:meras0704,项目名称:Solution_Blatella.ML,代码行数:59,代码来源:GrpClassDataAccess.cs


示例8: GetSqlConnection

 public static Return<SqlConnection> GetSqlConnection(string connectionString)
 {
     Return<SqlConnection> _answer = new Return<SqlConnection>();
     if (string.IsNullOrEmpty(connectionString))
     {
         _answer.theresError = true;
         _answer.error = Utility.GetError(new ArgumentException("connectionString"), typeof(Utility));
     }
     else
     {
         try
         {
             int _indexInit = connectionString.IndexOf("["), _indexEnd = connectionString.IndexOf("]");
             if (_indexInit < 0 || _indexEnd < 0 || _indexInit >= _indexEnd)
             {
                 string _message = "The connection string has a wrong format";
                 _answer.theresError = true;
                 _answer.error = Utility.GetError(new Exception(_message), typeof(DataUtility));
             }
             else
             {
                 string _password = connectionString.Substring(_indexInit + 1, _indexEnd - _indexInit - 1);
                 if (string.IsNullOrEmpty(_password))
                 {
                     string _message = "The password in the connection string is empty";
                     _answer.theresError = true;
                     _answer.error = Utility.GetError(new Exception(_message), typeof(DataUtility));
                 }
                 else
                 {
                     Return<string> _answerDecryptString = SecurityUtility.DecryptString(_password);
                     if (_answerDecryptString.theresError)
                     {
                         _answer.theresError = true;
                         _answer.error = _answerDecryptString.error;
                     }
                     else
                     {
                         string _firPart = connectionString.Substring(0, _indexInit)
                             , _lastPart = connectionString.Substring(_indexEnd + 1, connectionString.Length - _indexEnd - 1);
                         string _realConnectionString = string.Format("{0}{1}{2}", _firPart, _answerDecryptString.data, _lastPart);
                         _answer.data = new SqlConnection(_realConnectionString);
                     }
                 }
             }
         }
         catch (Exception _ex)
         {
             _answer.theresError = true;
             _answer.error = Utility.GetError(_ex, typeof(Utility));
         }
     }
     return _answer;
 }
开发者ID:meras0704,项目名称:Solution_Blatella.Common,代码行数:54,代码来源:DataUtility.cs


示例9: DecryptString

        public static Return<string> DecryptString(string inputString, string key)
        {
            Return<string> _answer = new Return<string>() { data = string.Empty };
            if (string.IsNullOrEmpty(inputString))
            {
                _answer.theresError = true;
                _answer.error = Utility.GetError(new ArgumentException("inputString"), typeof(Utility));
            }
            else
                if (string.IsNullOrEmpty(key))
                {
                    _answer.theresError = true;
                    _answer.error = Utility.GetError(new ArgumentException("key"), typeof(Utility));
                }
                else
                {
                    try
                    {
                        TripleDESCryptoServiceProvider _tripleDESCryptoServiceProvider = new TripleDESCryptoServiceProvider();
                        // Put the string into a byte array
                        byte[] _inputbyteArray = new byte[inputString.Length / 2]; //Encoding.UTF8.GetBytes(inputString);
                        // Create the crypto objects, with the key, as passed in
                        MD5CryptoServiceProvider _hashMD5 = new MD5CryptoServiceProvider();
                        _tripleDESCryptoServiceProvider.Key = _hashMD5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(key));
                        _tripleDESCryptoServiceProvider.Mode = CipherMode.ECB;
                        // Put the input string into the byte array
                        for (int _x = 0; _x < _inputbyteArray.Length; _x++)
                        {
                            Int32 _iJ = (Convert.ToInt32(inputString.Substring(_x * 2, 2), 16));
                            _inputbyteArray[_x] = new Byte();
                            _inputbyteArray[_x] = (byte)_iJ;
                        }
                        MemoryStream _memoryStream = new MemoryStream();
                        CryptoStream _cryptoStream = new CryptoStream(_memoryStream, _tripleDESCryptoServiceProvider.CreateDecryptor(), CryptoStreamMode.Write);
                        // Flush the data through the crypto stream into the memory stream
                        _cryptoStream.Write(_inputbyteArray, 0, _inputbyteArray.Length);
                        _cryptoStream.FlushFinalBlock();

                        // Get the decrypted data back from the memory stream
                        StringBuilder _stringBuilder = new StringBuilder();
                        byte[] _byteArray = _memoryStream.ToArray();
                        _memoryStream.Close();
                        for (int I = 0; I < _byteArray.Length; I++)
                            _stringBuilder.Append((char)(_byteArray[I]));
                        _answer.data = _stringBuilder.ToString();
                    }
                    catch (Exception _ex)
                    {
                        _answer.theresError = true;
                        _answer.error = Utility.GetError(_ex, typeof(Utility));
                    }
                }
            return _answer;
        }
开发者ID:meras0704,项目名称:Solution_Blatella.Common,代码行数:54,代码来源:SecurityUtility.cs


示例10: EncryptString

 public static Return<string> EncryptString(string inputString, string key)
 {
     Return<string> _answer = new Return<string>() { data = string.Empty };
     if (string.IsNullOrEmpty(inputString))
     {
         _answer.theresError = true;
         _answer.error = Utility.GetError(new ArgumentException("inputString"), typeof(Utility));
     }
     else
         if (string.IsNullOrEmpty(key))
         {
             _answer.theresError = true;
             _answer.error = Utility.GetError(new ArgumentException("key"), typeof(Utility));
         }
         else
         {
             try
             {
                 TripleDESCryptoServiceProvider _tripleDESCryptoServiceProvider = new TripleDESCryptoServiceProvider();
                 // Put the string into a byte array
                 byte[] _inputbyteArray = Encoding.UTF8.GetBytes(inputString);
                 // Create the crypto objects, with the key, as passed in
                 MD5CryptoServiceProvider _hashMD5 = new MD5CryptoServiceProvider();
                 _tripleDESCryptoServiceProvider.Key = _hashMD5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(key));
                 _tripleDESCryptoServiceProvider.Mode = CipherMode.ECB;
                 MemoryStream _memoryStream = new MemoryStream();
                 CryptoStream _cryptoStream = new CryptoStream(_memoryStream, _tripleDESCryptoServiceProvider.CreateEncryptor(), CryptoStreamMode.Write);
                 // Write the byte array into the crypto stream
                 // (It will end up in the memory stream)
                 _cryptoStream.Write(_inputbyteArray, 0, _inputbyteArray.Length);
                 _cryptoStream.FlushFinalBlock();
                 // Get the data back from the memory stream, and into a string
                 StringBuilder _stringBuilder = new StringBuilder();
                 byte[] _byteArray = _memoryStream.ToArray();
                 _memoryStream.Close();
                 for (int I = 0; I < _byteArray.Length; I++)
                 {
                     //Format as hex
                     _stringBuilder.AppendFormat("{0:X2}", _byteArray[I]);
                 }
                 _answer.data = _stringBuilder.ToString();
             }
             catch (Exception _ex)
             {
                 _answer.theresError = true;
                 _answer.error = Utility.GetError(_ex, typeof(Utility));
             }
         }
     return _answer;
 }
开发者ID:meras0704,项目名称:Solution_Blatella.Common,代码行数:50,代码来源:SecurityUtility.cs


示例11: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string strParamID = Request["ReturnID"];

            if (!string.IsNullOrEmpty(strParamID))
            {
                returnObj = ReturnBLL.Get(strParamID.ToInt());

                if (returnObj != null)
                {
                    LabelTitle1.Text = "BIÊN BẢN THU HỒI";

                    LoadReturn();

                    RedBloodDataContext db = new RedBloodDataContext();

                    var v1 = db.PackOrders.Where(r => r.ReturnID.Value == returnObj.ID)
                        .Select(r => r.Pack)
                        .ToList();

                    var v = v1.GroupBy(r => r.ProductCode)
                        .Select(r => new
                        {
                            ProductDesc = ProductBLL.GetDesc(r.Key),
                            ProductCode = r.Key,
                            Sum = r.Count(),
                            BloodGroupSumary = r.GroupBy(r1 => r1.Donation.BloodGroup).Select(r1 => new
                            {
                                BloodGroupDesc = BloodGroupBLL.GetDescription(r1.Key),
                                Total = r1.Count(),
                                VolumeSumary = r1.GroupBy(r2 => r2.Volume).Select(r2 => new
                                {
                                    Volume = r2.Key.HasValue ? r2.Key.Value.ToString() : "_",
                                    Total = r2.Count(),
                                    DINList = r2.Select(r3 => new { DIN = r3.DIN }).OrderBy(r4 => r4.DIN),
                                }).OrderBy(r2 => r2.Volume)
                            }).OrderBy(r1 => r1.BloodGroupDesc),
                        });

                    GridViewSum.DataSource = v;
                    GridViewSum.DataBind();

                    LableCount.Text = v1.Count().ToStringRemoveZero();
                }
            }
        }
    }
开发者ID:ghostnguyen,项目名称:daccf960-44f9-4f95-91c4-b1aba37effe1,代码行数:49,代码来源:PrintReturn.aspx.cs


示例12: JsonMtGOX

 public JsonMtGOX()
 {
     high = new High();
     low = new Low();
     avg = new Avg();
     vwap = new Vwap();
     vol = new Vol();
     lastlocal = new LastLocal();
     lastorig = new LastOrig();
     lastall = new LastAll();
     last = new Last();
     buy = new Buy();
     sell = new Sell();
     rootobject = new RootObject();
     returnObject = new Return();
 }
开发者ID:ryvers,项目名称:CryptoDelivery,代码行数:16,代码来源:JsonMtGOX.cs


示例13: Add

    public static int Add(List<int> packOrderIDList, string note)
    {
        RedBloodDataContext db = new RedBloodDataContext();

        List<PackOrder> poL = PackOrderBLL.Get4Return(db, packOrderIDList);

        Return re = new Return();
        re.Note = note;

        db.Returns.InsertOnSubmit(re);
        db.SubmitChanges();

        foreach (var item in packOrderIDList)
        {
            PackOrderBLL.Return(re.ID, item, note);
        }

        return re.ID;
    }
开发者ID:ghostnguyen,项目名称:redblood,代码行数:19,代码来源:ReturnBLL.cs


示例14: Return_SetsProgramCounterToDecodedAddress

        public void Return_SetsProgramCounterToDecodedAddress()
        {
            // Arrange
            var returner = new Return();
            var stack = new Mock<IStack>();
            var decoder = new Mock<IDecoder>();
            decoder.Setup(d => d.Decode(It.IsAny<UInt64>()))
                .Returns(new Instruction { Operand = 999999999 });

            var context = new ExecutionContext
            {
                Stack = stack.Object,
                Decoder = decoder.Object
            };

            // Act
            returner.Execute(context, null);

            // Asserty
            context.ProgramCounter.Should().Be(999999999);
        }
开发者ID:hkra,项目名称:Computer,代码行数:21,代码来源:ReturnTests.cs


示例15: Return_CallsDecodeToGetAddress

        public void Return_CallsDecodeToGetAddress()
        {
            // Arrange
            var returner = new Return();
            var stack = new Mock<IStack>();
            var decoder = new Mock<IDecoder>();
            decoder.Setup(d => d.Decode(It.IsAny<UInt64>()))
                .Returns(new Instruction { Operand = 999999999 });

            var context = new ExecutionContext
            {
                Stack = stack.Object,
                Decoder = decoder.Object
            };

            // Act
            returner.Execute(context, null);

            // Asserty
            decoder.Verify(d => d.Decode(It.IsAny<UInt64>()), Times.Once);
        }
开发者ID:hkra,项目名称:Computer,代码行数:21,代码来源:ReturnTests.cs


示例16: Grouping

		/// <summary>
		/// Performs a  grouping.
		/// </summary>
		/// <param name="entities">object id,variable id, variable description</param>
		/// <returns>A list of groupings</returns>
		public Return<List<List<BlatellaGroup>>> Grouping(SortedList<int, SortedList<int, ICharacteristic>> entities)
		{
			Return<List<List<BlatellaGroup>>> _answer = new Return<List<List<BlatellaGroup>>>() { data = new List<List<BlatellaGroup>>() };
			if (entities == null)
			{
				_answer.theresError = true;
				_answer.error = Utility.GetError(new ArgumentNullException("entities"), this.GetType());
			}
			else
			{
				try
				{
					_answer = GroupingKMeans(entities);
				}
				catch (Exception _ex)
				{
					_answer.theresError = true;
					_answer.error = Utility.GetError(_ex, this.GetType());
				}
			}
			return _answer;
		}
开发者ID:meras0704,项目名称:Solution_Blatella.ML,代码行数:27,代码来源:GroupingUtility.cs


示例17: StandardDeviation

 public static Return<double> StandardDeviation(List<double> numbers)
 {
     Return<double> _answer = new Return<double>();
     try
     {
         if (numbers == null)
         {
             _answer.theresError = true;
             _answer.error = Utility.GetError(new ArgumentException("numbers"), typeof(Mathematics));
         }
         else
             if (!numbers.Any())
                 _answer.data = 0;
             else
             {
                 Return<double> _answerArithmeticMean = ArithmeticMean(numbers);
                 if (_answerArithmeticMean.theresError)
                 {
                     _answer.theresError = true;
                     _answer.error = _answerArithmeticMean.error;
                 }
                 else
                 {
                     double _arithmeticMean = _answerArithmeticMean.data, _variance = 0;
                     int _count = numbers.Count();
                     numbers.ForEach(n => _variance += Math.Pow(n - _arithmeticMean, 2));
                     _variance = _variance / _count;
                     _answer.data = Math.Sqrt(_variance);
                 }
             }
     }
     catch (Exception _ex)
     {
         _answer.theresError = true;
         _answer.error = Utility.GetError(_ex, typeof(Mathematics));
     }
     return _answer;
 }
开发者ID:meras0704,项目名称:Solution_Blatella.Common,代码行数:38,代码来源:Mathematics.cs


示例18: CreateHoistedBaseCallProxy

		//
		// Creates a proxy base method call inside this container for hoisted base member calls
		//
		public MethodSpec CreateHoistedBaseCallProxy (ResolveContext rc, MethodSpec method)
		{
			Method proxy_method;

			//
			// One proxy per base method is enough
			//
			if (hoisted_base_call_proxies == null) {
				hoisted_base_call_proxies = new Dictionary<MethodSpec, Method> ();
				proxy_method = null;
			} else {
				hoisted_base_call_proxies.TryGetValue (method, out proxy_method);
			}

			if (proxy_method == null) {
				string name = CompilerGeneratedContainer.MakeName (method.Name, null, "BaseCallProxy", hoisted_base_call_proxies.Count);

				MemberName member_name;
				TypeArguments targs = null;
				TypeSpec return_type = method.ReturnType;
				var local_param_types = method.Parameters.Types;

				if (method.IsGeneric) {
					//
					// Copy all base generic method type parameters info
					//
					var hoisted_tparams = method.GenericDefinition.TypeParameters;
					var tparams = new TypeParameters ();

					targs = new TypeArguments ();
					targs.Arguments = new TypeSpec[hoisted_tparams.Length];
					for (int i = 0; i < hoisted_tparams.Length; ++i) {
						var tp = hoisted_tparams[i];
						var local_tp = new TypeParameter (tp, null, new MemberName (tp.Name, Location), null);
						tparams.Add (local_tp);

						targs.Add (new SimpleName (tp.Name, Location));
						targs.Arguments[i] = local_tp.Type;
					}

					member_name = new MemberName (name, tparams, Location);

					//
					// Mutate any method type parameters from original
					// to newly created hoisted version
					//
					var mutator = new TypeParameterMutator (hoisted_tparams, tparams);
					return_type = mutator.Mutate (return_type);
					local_param_types = mutator.Mutate (local_param_types);
				} else {
					member_name = new MemberName (name);
				}

				var base_parameters = new Parameter[method.Parameters.Count];
				for (int i = 0; i < base_parameters.Length; ++i) {
					var base_param = method.Parameters.FixedParameters[i];
					base_parameters[i] = new Parameter (new TypeExpression (local_param_types [i], Location),
						base_param.Name, base_param.ModFlags, null, Location);
					base_parameters[i].Resolve (this, i);
				}

				var cloned_params = ParametersCompiled.CreateFullyResolved (base_parameters, method.Parameters.Types);
				if (method.Parameters.HasArglist) {
					cloned_params.FixedParameters[0] = new Parameter (null, "__arglist", Parameter.Modifier.NONE, null, Location);
					cloned_params.Types[0] = Module.PredefinedTypes.RuntimeArgumentHandle.Resolve ();
				}

				// Compiler generated proxy
				proxy_method = new Method (this, new TypeExpression (return_type, Location),
					Modifiers.PRIVATE | Modifiers.COMPILER_GENERATED | Modifiers.DEBUGGER_HIDDEN,
					member_name, cloned_params, null);

				var block = new ToplevelBlock (Compiler, proxy_method.ParameterInfo, Location) {
					IsCompilerGenerated = true
				};

				var mg = MethodGroupExpr.CreatePredefined (method, method.DeclaringType, Location);
				mg.InstanceExpression = new BaseThis (method.DeclaringType, Location);
				if (targs != null)
					mg.SetTypeArguments (rc, targs);

				// Get all the method parameters and pass them as arguments
				var real_base_call = new Invocation (mg, block.GetAllParametersArguments ());
				Statement statement;
				if (method.ReturnType.Kind == MemberKind.Void)
					statement = new StatementExpression (real_base_call);
				else
					statement = new Return (real_base_call, Location);

				block.AddStatement (statement);
				proxy_method.Block = block;

				members.Add (proxy_method);
				proxy_method.Define ();
				proxy_method.PrepareEmit ();

				hoisted_base_call_proxies.Add (method, proxy_method);
//.........这里部分代码省略.........
开发者ID:0xd4d,项目名称:NRefactory,代码行数:101,代码来源:class.cs


示例19: GetWords

		/// <summary>
		/// Receives a list of words and makes a word collection.
		/// </summary>
		/// <param name="strings">strings, aren't separated into words</param>
		/// <returns>list of words</returns>
		public static Return<List<string>> GetWords(List<string> strings)
		{
			Return<List<string>> _answer = new Return<List<string>>() { data = new List<string>() };
			if (strings == null)
			{
				_answer.theresError = true;
				_answer.error = Utility.GetError(new ArgumentNullException("strings"), typeof(MLUtility));
			}
			else
			{
				try
				{
					Return<List<string>> _answerExtractSentences = ExtractSentences(strings);
					if (_answerExtractSentences.theresError)
					{
						_answer.theresError = true;
						_answer.error = _answerExtractSentences.error;
					}
					else
					{//tenemos las oraciones
						string _words = string.Join(MLConstants.STRING_SPACE_CHARACTER, _answerExtractSentences.data);
						Dictionary<string, string> _replacements = new Dictionary<string, string>();
						_replacements.Add("'", MLConstants.STRING_SPACE_CHARACTER);
						_replacements.Add(",", MLConstants.STRING_SPACE_CHARACTER);
						_replacements.Add(":", MLConstants.STRING_SPACE_CHARACTER);
						_replacements.Add(";", MLConstants.STRING_SPACE_CHARACTER);
						_replacements.Add("(", MLConstants.STRING_SPACE_CHARACTER);
						_replacements.Add(")", MLConstants.STRING_SPACE_CHARACTER);
						_replacements.Add(@"\", MLConstants.STRING_SPACE_CHARACTER);
						_replacements.Add("/", MLConstants.STRING_SPACE_CHARACTER);
						_replacements.Add(@"""", MLConstants.STRING_SPACE_CHARACTER);
						_replacements.Add(Environment.NewLine, string.Empty);

						foreach (KeyValuePair<string, string> _r in _replacements)
							_words = _words.Replace(_r.Key, _r.Value);

						_words = _words.Replace((char)13, MLConstants.SPACE_CHARACTER);

						_answer.data = _words.Split(new string[] { MLConstants.STRING_SPACE_CHARACTER }, StringSplitOptions.RemoveEmptyEntries).ToList();

					}//tenemos las oraciones
				}
				catch (Exception _ex)
				{
					_answer.theresError = true;
					_answer.error = Utility.GetError(_ex, typeof(MLUtility));
				}
			}
			return _answer;
		}
开发者ID:meras0704,项目名称:Solution_Blatella.ML,代码行数:55,代码来源:MLUtility.cs


示例20: GetDate

		public static Return<DateTime?> GetDate(string text, bool start)
		{
			Return<DateTime?> _answer = new Return<DateTime?>();
			if (string.IsNullOrWhiteSpace(text))
			{
				_answer.theresError = true;
				_answer.error = Utility.GetError(new ArgumentNullException("text"), typeof(MLUtility));
			}
			else
			{
				try
				{
					int? _year = null, _month = null, _day = null;
					if (!_answer.theresError)
					{
						Return<int?> _answerPart = MLUtility.GetYearFromISO8601Text(text);
						if (_answerPart.theresError)
						{
							_answer.theresError = true;
							_answer.error = _answerPart.error;
						}
						else
							_year = _answerPart.data;
					}
					if (!_answer.theresError)
					{
						Return<int?> _answerPart = MLUtility.GetMonthFromISO8601Text(text);
						if (_answerPart.theresError)
						{
							_answer.theresError = true;
							_answer.error = _answerPart.error;
						}
						else
							_month = _answerPart.data;
					}
					if (!_answer.theresError)
					{
						Return<int?> _answerPart = MLUtility.GetDayFromISO8601Text(text);
						if (_answerPart.theresError)
						{
							_answer.theresError = true;
							_answer.error = _answerPart.error;
						}
						else
							_day = _answerPart.data;
					}
					if (!_answer.theresError)
					{
						if (_year.HasValue)
						{
							if (!_month.HasValue)
								_answer.data = start ? _answer.data = new DateTime(_year.Value, 1, 1) : new DateTime(_year.Value, 12, MLUtility.GetFinalDay(_year.Value, 12));//a whole year
							else
								if (!_day.HasValue)
									_answer.data = start ? _answer.data = new DateTime(_year.Value, _month.Value, 1) : new DateTime(_year.Value, _month.Value, MLUtility.GetFinalDay(_year.Value, _month.Value));//a whole month
								else
									if (!DateTime.IsLeapYear(_year.Value) && _month.Value == 2 && _day.Value == 29)
										_answer.data = new DateTime(_year.Value, _month.Value, 28);
									else
										_answer.data = new DateTime(_year.Value, _month.Value, _day.Value);
						}
					}
				}
				catch (Exception _ex)
				{
					_answer.theresError = true;
					_answer.error = Utility.GetError(_ex, typeof(MLUtility));
				}
			}
			return _answer;
		}
开发者ID:meras0704,项目名称:Solution_Blatella.ML,代码行数:71,代码来源:MLUtility.cs



注:本文中的Return类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ReturnCode类代码示例发布时间:2022-05-24
下一篇:
C# RetryPolicy类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap