검색결과 리스트
Method에 해당되는 글 2건
- 2012.08.30 [jQuery] val 메소드 getter, setter 구별법
- 2012.03.22 [C#] Dynamic Method Call With Out Parameter
글
결국 arguments의 length 속성을 이용한다.
val: function( value ) {
var hooks, ret, isFunction,
elem = this[0];
if ( !arguments.length ) {
if ( elem ) {
hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
return ret;
}
ret = elem.value;
return typeof ret === "string" ?
// handle most common string cases
ret.replace(rreturn, "") :
// handle cases where value is null/undef or number
ret == null ? "" : ret;
}
return;
}
isFunction = jQuery.isFunction( value );
return this.each(function( i ) {
var self = jQuery(this), val;
if ( this.nodeType !== 1 ) {
return;
}
if ( isFunction ) {
val = value.call( this, i, self.val() );
} else {
val = value;
}
// Treat null/undefined as ""; convert numbers to string
if ( val == null ) {
val = "";
} else if ( typeof val === "number" ) {
val += "";
} else if ( jQuery.isArray( val ) ) {
val = jQuery.map(val, function ( value ) {
return value == null ? "" : value + "";
});
}
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
// If set returns undefined, fall back to normal setting
if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
this.value = val;
}
});
}
'JavaScript > jQuery' 카테고리의 다른 글
[jQuery] jQuery의 핵심 Selector Sizzle (0) | 2012.11.07 |
---|---|
[jQuery] jQuery 구조 분석 (0) | 2012.11.07 |
[jQuery] PlugIn 만들기 (0) | 2012.08.08 |
[jQuery] .attr("disabled") .attr("readonly") 리턴값 (0) | 2012.08.01 |
[jQuery] .each $.each 순회중 continue, break 하기 (0) | 2012.07.26 |
트랙백
댓글
글
호출해 준다.
// class public class MyObject { pub int Connect() { // 접속 ... } public void GetLastError(out int errorCode, out string errorMessage) { // 내부 코드들 ... } }
// ErrorUtil public class ErrorUtil { private static readonly string methodName = "GetLastError"; private static int errorCode = 0; private static string errorMessage = ""; public static int ErrorCode { get { return errorCode; } } public static string ErrorMessage { get { return errorMessage; } } public static bool GetLastError(object obj) { try { Type t = obj.GetType(); MethodInfo info = t.GetMethod( ErrorUtil.methodName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, null, new[] { typeof(int).MakeByRefType(), typeof(string).MakeByRefType() }, null ); if (info != null) { object[] parameters = new object[2]; info.Invoke(obj, parameters); errorCode = (int)parameters[0]; errorMessage = (string)parameters[1]; return true; } else { errorMessage = String.Format("{0} 메소드를 찾을수 없거나, 파라미터가 정확하지 않습니다.", ErrorUtil.methodName); return false; } } catch (Exception ex) { errorMessage = ex.Message; return false; } } }
// 사용예 MyObject oCommpany = new MyObject(); int retCode = oCompany.Connect(); if (retCode != 0) { ErrorUtil.GetLastError(oCompany); MessageBox.Show(ErrorUtil.ErrorMessage); }
'.Net > C#' 카테고리의 다른 글
[C#] log4net (0) | 2012.04.03 |
---|---|
[C#] vshosting.exe 가 뭘까요? (0) | 2012.03.26 |
[즐겨찾기] C# TreeView MultiSelect (0) | 2012.03.15 |
[C#] internal 지정자 (0) | 2012.03.12 |
[즐겨찾기] 무료서적 Inside C# 2nd (0) | 2012.03.10 |
RECENT COMMENT